test: encrypt test_remove_member_bcc

This commit is contained in:
link2xt
2025-04-10 18:33:39 +00:00
committed by l
parent 54a6b0efcb
commit 7a4f0eed23

View File

@@ -773,19 +773,24 @@ async fn test_selfavatar_unencrypted_signed() {
/// Test that removed member address does not go into the `To:` field. /// Test that removed member address does not go into the `To:` field.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_remove_member_bcc() -> Result<()> { async fn test_remove_member_bcc() -> Result<()> {
let mut tcm = TestContextManager::new();
// Alice creates a group with Bob and Claire and then removes Bob. // Alice creates a group with Bob and Claire and then removes Bob.
let alice = TestContext::new_alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await;
let claire_addr = "claire@foo.de"; let bob_id = alice.add_or_lookup_contact_id(bob).await;
let bob_id = Contact::create(&alice, "Bob", "bob@example.net").await?; let charlie_id = alice.add_or_lookup_contact_id(charlie).await;
let claire_id = Contact::create(&alice, "Claire", claire_addr).await?; let charlie_contact = Contact::get_by_id(alice, charlie_id).await?;
let charlie_addr = charlie_contact.get_addr();
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "foo").await?; let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foo").await?;
add_contact_to_chat(&alice, alice_chat_id, bob_id).await?; add_contact_to_chat(alice, alice_chat_id, bob_id).await?;
add_contact_to_chat(&alice, alice_chat_id, claire_id).await?; add_contact_to_chat(alice, alice_chat_id, charlie_id).await?;
send_text_msg(&alice, alice_chat_id, "Creating a group".to_string()).await?; send_text_msg(alice, alice_chat_id, "Creating a group".to_string()).await?;
remove_contact_from_chat(&alice, alice_chat_id, claire_id).await?; remove_contact_from_chat(alice, alice_chat_id, charlie_id).await?;
let remove = alice.pop_sent_msg().await; let remove = alice.pop_sent_msg().await;
let remove_payload = remove.payload(); let remove_payload = remove.payload();
let parsed = mailparse::parse_mail(remove_payload.as_bytes())?; let parsed = mailparse::parse_mail(remove_payload.as_bytes())?;
@@ -797,8 +802,8 @@ async fn test_remove_member_bcc() -> Result<()> {
for to_addr in to.iter() { for to_addr in to.iter() {
match to_addr { match to_addr {
mailparse::MailAddr::Single(ref info) => { mailparse::MailAddr::Single(ref info) => {
// Addresses should be of existing members (Alice and Bob) and not Claire. // Addresses should be of existing members (Alice and Bob) and not Charlie.
assert_ne!(info.addr, claire_addr); assert_ne!(info.addr, charlie_addr);
} }
mailparse::MailAddr::Group(_) => { mailparse::MailAddr::Group(_) => {
panic!("Group addresses are not expected here"); panic!("Group addresses are not expected here");