This commit is contained in:
Septias
2025-07-17 12:22:16 +02:00
parent e03e2d9a68
commit 274c8f6fdf

View File

@@ -1,3 +1,4 @@
use crate::headerdef::HeaderDef;
use num_traits::FromPrimitive;
use super::*;
@@ -805,3 +806,24 @@ async fn test_sanitize_filename_message() -> Result<()> {
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_autocrypt_gossip_chat_assign() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let alice_chat_id = alice.create_chat(bob).await.id;
alice.set_config_u32(Config::GossipPeriod, 0).await?;
tcm.section("Bob receives a normal message from alice, and assigns it a chat");
let sent_msg = alice.send_text(alice_chat_id, "hi").await;
let bob_chat_id = bob.recv_msg(&sent_msg).await.chat_id;
tcm.section("Bob receives a message with a gossip header and assigns it to the same chat");
let sent_msg = alice.send_text(alice_chat_id, "hi").await;
let msg = bob.parse_msg(&sent_msg).await;
assert!(msg.header_exists(HeaderDef::AutocryptGossip));
assert_eq!(bob.recv_msg(&sent_msg).await.chat_id, bob_chat_id);
Ok(())
}