From 82f8bbb81e47f40fe5ab8e27560d10321ba3dbea Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Fri, 19 Jan 2024 14:35:00 +0100 Subject: [PATCH] Fix test load_private_device_factor_source_by_id --- ...te_hierarchical_deterministic_factor_source.rs | 15 ++++++++++----- profile/src/wallet/wallet_accounts.rs | 14 +++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/profile/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs b/profile/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs index 058a709b..0b221de0 100644 --- a/profile/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs +++ b/profile/src/v100/factors/factor_sources/private_hierarchical_deterministic_factor_source.rs @@ -89,16 +89,21 @@ impl PrivateHierarchicalDeterministicFactorSource { impl HasPlaceholder for PrivateHierarchicalDeterministicFactorSource { fn placeholder() -> Self { - Self::new_with_mnemonic_with_passphrase( + Self::new( MnemonicWithPassphrase::placeholder(), - WalletClientModel::Iphone, + DeviceFactorSource::placeholder_babylon(), ) } fn placeholder_other() -> Self { - Self::new_with_mnemonic_with_passphrase( - MnemonicWithPassphrase::placeholder_other(), - WalletClientModel::Android, + let mwp = MnemonicWithPassphrase::placeholder_other(); + Self::new( + mwp.clone(), + DeviceFactorSource::new( + FactorSourceIDFromHash::new_for_device(mwp), + FactorSourceCommon::placeholder_olympia(), + DeviceFactorSourceHint::placeholder_other(), + ), ) } } diff --git a/profile/src/wallet/wallet_accounts.rs b/profile/src/wallet/wallet_accounts.rs index 25f6e7c1..28ee2041 100644 --- a/profile/src/wallet/wallet_accounts.rs +++ b/profile/src/wallet/wallet_accounts.rs @@ -204,9 +204,9 @@ mod tests { sync::atomic::AtomicBool, }; - use __private__::{Mutex, RwLock}; - use crate::prelude::*; + pub use pretty_assertions::{assert_eq, assert_ne}; + use std::sync::RwLock; #[test] fn change_display_name_of_accounts() { @@ -362,11 +362,11 @@ mod tests { let key = SecureStorageKey::DeviceFactorSourceMnemonic { factor_source_id: private.clone().factor_source.id.clone(), }; - assert!(storage.save_data(key.clone(), data.clone()).is_ok()); + assert!(storage.save_data(key.clone(), data).is_ok()); - assert_eq!( - wallet.load_private_device_factor_source_by_id(&private.factor_source.id.clone()), - Ok(private.clone()) - ); + let loaded = wallet + .load_private_device_factor_source_by_id(&private.factor_source.id.clone()) + .unwrap(); + assert_eq!(loaded, private); } }