From 6efd216f35558797cf9b5af0ccb3680bbb25d2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 19 Mar 2020 09:39:22 +0100 Subject: [PATCH] cryptpo: Add test that the account is updated correctly in the store. --- src/crypto/store/sqlite.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/crypto/store/sqlite.rs b/src/crypto/store/sqlite.rs index b2efa6fd..1a32194e 100644 --- a/src/crypto/store/sqlite.rs +++ b/src/crypto/store/sqlite.rs @@ -240,4 +240,28 @@ mod test { assert_eq!(*acc, loaded_account); } + + #[tokio::test] + async fn save_and_share_account() { + let mut store = get_store().await; + let account = get_account(); + + store + .save_account(account.clone()) + .await + .expect("Can't save account"); + + account.lock().await.shared = true; + + store + .save_account(account.clone()) + .await + .expect("Can't save account"); + + let loaded_account = store.load_account().await.expect("Can't load account"); + let loaded_account = loaded_account.unwrap(); + let acc = account.lock().await; + + assert_eq!(*acc, loaded_account); + } }