fix: Don't fail if going to send plaintext, but some peerstate is missing

F.e. this allows to reexecute Securejoin and fix the problem.
This commit is contained in:
iequidoo
2024-06-26 14:21:44 -03:00
committed by iequidoo
parent 71104e9312
commit ce44312ac0
2 changed files with 22 additions and 4 deletions

View File

@@ -179,6 +179,26 @@ async fn test_create_verified_oneonone_chat() -> Result<()> {
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_missing_peerstate_reexecute_securejoin() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let alice_addr = alice.get_config(Config::Addr).await?.unwrap();
let bob = &tcm.bob().await;
enable_verified_oneonone_chats(&[alice, bob]).await;
tcm.execute_securejoin(bob, alice).await;
let chat = bob.get_chat(alice).await;
assert!(chat.is_protected());
bob.sql
.execute("DELETE FROM acpeerstates WHERE addr=?", (&alice_addr,))
.await?;
tcm.execute_securejoin(bob, alice).await;
let chat = bob.get_chat(alice).await;
assert!(chat.is_protected());
assert!(!chat.is_protection_broken());
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_create_unverified_oneonone_chat() -> Result<()> {
let mut tcm = TestContextManager::new();