test: Improve test_send_avatar_in_securejoin()

This commit is contained in:
Hocuri
2025-08-07 16:45:20 +02:00
parent 58d0fd39b5
commit 5da6ca1ec4

View File

@@ -834,8 +834,19 @@ async fn test_send_avatar_in_securejoin() -> Result<()> {
let qr = get_securejoin_qr(scanned, Some(chat_id)).await.unwrap(); let qr = get_securejoin_qr(scanned, Some(chat_id)).await.unwrap();
tcm.exec_securejoin_qr(scanner, scanned, &qr).await; tcm.exec_securejoin_qr(scanner, scanned, &qr).await;
} }
async fn exec_securejoin_broadcast(
tcm: &TestContextManager,
scanner: &TestContext,
scanned: &TestContext,
) {
let chat_id = chat::create_broadcast(scanned, "group".to_string())
.await
.unwrap();
let qr = get_securejoin_qr(scanned, Some(chat_id)).await.unwrap();
tcm.exec_securejoin_qr(scanner, scanned, &qr).await;
}
for alice_scans in [true, false] { for round in 0..6 {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
@@ -846,15 +857,26 @@ async fn test_send_avatar_in_securejoin() -> Result<()> {
.set_config(Config::Selfavatar, Some(file.to_str().unwrap())) .set_config(Config::Selfavatar, Some(file.to_str().unwrap()))
.await?; .await?;
if alice_scans { match round {
tcm.execute_securejoin(alice, bob).await; 0 => {
//exec_securejoin_group(&tcm, alice, bob).await; tcm.execute_securejoin(alice, bob).await;
//exec_securejoin_broadcast(&tcm, alice, bob).await; }
// TODO also test these 1 => {
} else { tcm.execute_securejoin(bob, alice).await;
tcm.execute_securejoin(bob, alice).await; }
//exec_securejoin_group(&tcm, bob, alice).await; 2 => {
//exec_securejoin_broadcast(&tcm, alice, bob).await; exec_securejoin_group(&tcm, alice, bob).await;
}
3 => {
exec_securejoin_group(&tcm, bob, alice).await;
}
4 => {
exec_securejoin_broadcast(&tcm, alice, bob).await;
}
5 => {
exec_securejoin_broadcast(&tcm, bob, alice).await;
}
_ => panic!(),
} }
let alice_on_bob = bob.add_or_lookup_contact_no_key(alice).await; let alice_on_bob = bob.add_or_lookup_contact_no_key(alice).await;