Skip to content

Commit 968ec88

Browse files
committed
test_no_pgp_contacts_in_adhoc_chats
1 parent 1830f74 commit 968ec88

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/chat/chat_tests.rs

+36
Original file line numberDiff line numberDiff line change
@@ -4131,3 +4131,39 @@ async fn test_no_email_contacts_in_group_chats() -> Result<()> {
41314131

41324132
Ok(())
41334133
}
4134+
4135+
/// Tests that PGP-contacts cannot be added to ad-hoc groups.
4136+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
4137+
async fn test_no_pgp_contacts_in_adhoc_chats() -> Result<()> {
4138+
let mut tcm = TestContextManager::new();
4139+
let alice = &tcm.alice().await;
4140+
let bob = &tcm.bob().await;
4141+
let charlie = &tcm.charlie().await;
4142+
4143+
let chat_id = receive_imf(
4144+
alice,
4145+
b"Subject: Email thread\r\n\
4146+
From: [email protected]\r\n\
4147+
To: Bob <[email protected]>, Fiona <[email protected]>\r\n\
4148+
Date: Mon, 2 Dec 2023 16:59:39 +0000\r\n\
4149+
Message-ID: <[email protected]>\r\n\
4150+
\r\n\
4151+
Starting a new thread\r\n",
4152+
false,
4153+
)
4154+
.await?
4155+
.unwrap()
4156+
.chat_id;
4157+
4158+
let email_bob_contact_id = alice.add_or_lookup_email_contact_id(bob).await;
4159+
let pgp_charlie_contact_id = alice.add_or_lookup_contact_id(charlie).await;
4160+
4161+
// Email-contact should be added successfully.
4162+
add_contact_to_chat(alice, chat_id, email_bob_contact_id).await?;
4163+
4164+
// Adding PGP-contact should fail.
4165+
let res = add_contact_to_chat(alice, chat_id, pgp_charlie_contact_id).await;
4166+
assert!(res.is_err());
4167+
4168+
Ok(())
4169+
}

0 commit comments

Comments
 (0)