Skip to content

Commit c5b004e

Browse files
committed
Fix test_dont_readd_with_normal_msg
1 parent 6276b91 commit c5b004e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/receive_imf/tests.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,8 +4273,9 @@ async fn test_delayed_removal_is_ignored() -> Result<()> {
42734273

42744274
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
42754275
async fn test_dont_readd_with_normal_msg() -> Result<()> {
4276-
let alice = TestContext::new_alice().await;
4277-
let bob = TestContext::new_bob().await;
4276+
let mut tcm = TestContextManager::new();
4277+
let alice = tcm.alice().await;
4278+
let bob = tcm.bob().await;
42784279

42794280
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
42804281

@@ -4289,6 +4290,7 @@ async fn test_dont_readd_with_normal_msg() -> Result<()> {
42894290
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
42904291
bob_chat_id.accept(&bob).await?;
42914292

4293+
// Bob leaves, but Alice didn't receive Bob's leave message.
42924294
remove_contact_from_chat(&bob, bob_chat_id, ContactId::SELF).await?;
42934295
bob.pop_sent_msg().await;
42944296
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 1);
@@ -4302,12 +4304,11 @@ async fn test_dont_readd_with_normal_msg() -> Result<()> {
43024304
.await?;
43034305
bob.recv_msg(&alice.pop_sent_msg().await).await;
43044306

4305-
// Alice didn't receive Bob's leave message although a lot of time has
4306-
// passed, so Bob must re-add themselves otherwise other members would think
4307-
// Bob is still here while they aren't. Bob should retry to leave if they
4308-
// think that Alice didn't re-add them on purpose (which is possible if Alice uses a classical
4309-
// MUA).
4310-
assert!(is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
4307+
// Bob received a message from Alice, but this should not re-add him to the group.
4308+
assert!(!is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
4309+
4310+
// Bob got an update that fiora is added nevertheless.
4311+
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 2);
43114312
Ok(())
43124313
}
43134314

0 commit comments

Comments
 (0)