Skip to content

test: test that key of the recipient is gossiped in 1:1 chats #6808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/chat/chat_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4050,3 +4050,35 @@ async fn test_send_delete_request_no_encryption() -> Result<()> {
assert_eq!(alice_chat.id.get_msg_cnt(alice).await?, 1);
Ok(())
}

/// Tests that in multi-device setup
/// second device learns the key of a contact
/// via Autocrypt-Gossip in 1:1 chats.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_oneone_gossip() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let alice2 = &tcm.alice().await;
let bob = &tcm.bob().await;

tcm.section("Alice imports Bob's vCard and sends a message from the first device");
let alice_chat = alice.create_chat(bob).await;
let sent_msg = alice.send_text(alice_chat.id, "Hello Bob!").await;

tcm.section("Alice receives a copy on second device");
let rcvd_msg = alice2.recv_msg(&sent_msg).await;
assert_eq!(rcvd_msg.get_showpadlock(), true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also check that the contact isn't verified? Maybe this is covered by other tests though


tcm.section("Alice sends a message from the second device");
let alice2_chat_id = rcvd_msg.chat_id;
let sent_msg2 = alice2
.send_text(alice2_chat_id, "Hello from second device!")
.await;

tcm.section("Bob receives a message from the second device");
let rcvd_msg2 = bob.recv_msg(&sent_msg2).await;
assert_eq!(rcvd_msg2.get_showpadlock(), true);
assert_eq!(rcvd_msg2.text, "Hello from second device!");

Ok(())
}
Loading