test: encrypt 15 more Rust tests

- chat::chat_tests::test_forward_group
- chat::chat_tests::test_resend_foreign_message_fails
- chat::chat_tests::test_resend_info_message_fails
- ephemeral::ephemeral_tests::test_ephemeral_timer_non_member
- receive_imf::receive_imf_tests::test_delayed_removal_is_ignored
- receive_imf::receive_imf_tests::test_dont_readd_with_normal_msg
- receive_imf::receive_imf_tests::test_dont_recreate_contacts_on_add_remove
- receive_imf::receive_imf_tests::test_member_left_does_not_create_chat
- receive_imf::receive_imf_tests::test_outgoing_private_reply_multidevice
- receive_imf::receive_imf_tests::test_recreate_member_list_on_missing_add_of_self
- receive_imf::receive_imf_tests::test_references
- receive_imf::receive_imf_tests::test_send_as_bot
- receive_imf::receive_imf_tests::test_unsigned_chat_group_hdr
- securejoin::securejoin_tests::test_unknown_sender
- webxdc::webxdc_tests::test_webxdc_reject_updates_from_non_groupmembers
This commit is contained in:
link2xt
2025-03-31 01:30:05 +00:00
committed by l
parent 8f3fc10625
commit ddc2f55a6f
6 changed files with 128 additions and 128 deletions

View File

@@ -2093,6 +2093,7 @@ async fn test_forward_group() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let bob = tcm.bob().await;
let charlie = tcm.charlie().await;
let alice_chat = alice.create_chat(&bob).await;
let bob_chat = bob.create_chat(&alice).await;
@@ -2100,12 +2101,12 @@ async fn test_forward_group() -> Result<()> {
// Alice creates a group with Bob.
let alice_group_chat_id =
create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let bob_id = Contact::create(&alice, "Bob", "bob@example.net").await?;
let claire_id = Contact::create(&alice, "Claire", "claire@example.net").await?;
let bob_id = alice.add_or_lookup_contact_id(&bob).await;
let charlie_id = alice.add_or_lookup_contact_id(&charlie).await;
add_contact_to_chat(&alice, alice_group_chat_id, bob_id).await?;
add_contact_to_chat(&alice, alice_group_chat_id, claire_id).await?;
add_contact_to_chat(&alice, alice_group_chat_id, charlie_id).await?;
let sent_group_msg = alice
.send_text(alice_group_chat_id, "Hi Bob and Claire")
.send_text(alice_group_chat_id, "Hi Bob and Charlie")
.await;
let bob_group_chat_id = bob.recv_msg(&sent_group_msg).await.chat_id;
@@ -2388,19 +2389,15 @@ async fn test_resend_own_message() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_resend_foreign_message_fails() -> Result<()> {
let alice = TestContext::new_alice().await;
let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?;
add_contact_to_chat(
&alice,
alice_grp,
Contact::create(&alice, "", "bob@example.net").await?,
)
.await?;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let alice_grp = create_group_chat(alice, ProtectionStatus::Unprotected, "grp").await?;
add_contact_to_chat(alice, alice_grp, alice.add_or_lookup_contact_id(bob).await).await?;
let sent1 = alice.send_text(alice_grp, "alice->bob").await;
let bob = TestContext::new_bob().await;
let msg = bob.recv_msg(&sent1).await;
assert!(resend_msgs(&bob, &[msg.id]).await.is_err());
assert!(resend_msgs(bob, &[msg.id]).await.is_err());
Ok(())
}
@@ -2444,24 +2441,23 @@ async fn test_resend_opportunistically_encryption() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_resend_info_message_fails() -> Result<()> {
let alice = TestContext::new_alice().await;
let alice_grp = create_group_chat(&alice, ProtectionStatus::Unprotected, "grp").await?;
add_contact_to_chat(
&alice,
alice_grp,
Contact::create(&alice, "", "bob@example.net").await?,
)
.await?;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await;
let alice_grp = create_group_chat(alice, ProtectionStatus::Unprotected, "grp").await?;
add_contact_to_chat(alice, alice_grp, alice.add_or_lookup_contact_id(bob).await).await?;
alice.send_text(alice_grp, "alice->bob").await;
add_contact_to_chat(
&alice,
alice,
alice_grp,
Contact::create(&alice, "", "claire@example.org").await?,
alice.add_or_lookup_contact_id(charlie).await,
)
.await?;
let sent2 = alice.pop_sent_msg().await;
assert!(resend_msgs(&alice, &[sent2.sender_msg_id]).await.is_err());
assert!(resend_msgs(alice, &[sent2.sender_msg_id]).await.is_err());
Ok(())
}

View File

@@ -5,7 +5,6 @@ use crate::chat::{
};
use crate::config::Config;
use crate::constants::DC_CHAT_ID_ARCHIVED_LINK;
use crate::contact::Contact;
use crate::download::DownloadState;
use crate::location;
use crate::message::markseen_msgs;
@@ -791,7 +790,7 @@ async fn test_ephemeral_timer_non_member() -> Result<()> {
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let alice_bob_contact_id = Contact::create(alice, "Bob", "bob@example.net").await?;
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
let alice_chat_id =
create_group_chat(alice, ProtectionStatus::Unprotected, "Group name").await?;
add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?;

View File

@@ -3313,6 +3313,7 @@ async fn test_outgoing_private_reply_multidevice() -> Result<()> {
let alice1 = tcm.alice().await;
let alice2 = tcm.alice().await;
let bob = tcm.bob().await;
let charlie = tcm.charlie().await;
// =============== Bob creates a group ===============
let group_id = chat::create_group_chat(&bob, ProtectionStatus::Unprotected, "Group").await?;
@@ -3321,8 +3322,8 @@ async fn test_outgoing_private_reply_multidevice() -> Result<()> {
time(),
group_id,
&[
bob.add_or_lookup_contact(&alice1).await.id,
Contact::create(&bob, "", "charlie@example.org").await?,
bob.add_or_lookup_contact_id(&alice1).await,
bob.add_or_lookup_contact_id(&charlie).await,
],
)
.await?;
@@ -3449,8 +3450,7 @@ async fn test_send_as_bot() -> Result<()> {
let alice = &tcm.alice().await;
alice.set_config(Config::Bot, Some("1")).await.unwrap();
let bob = &tcm.bob().await;
let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
let alice_bob_id = Contact::create(alice, "", &bob_addr).await?;
let alice_bob_id = alice.add_or_lookup_contact_id(bob).await;
let bob_chat_id = tcm.send_recv_accept(alice, bob, "hi").await.chat_id;
let alice_chat_id = ChatId::lookup_by_contact(alice, alice_bob_id)
.await?
@@ -4044,7 +4044,7 @@ async fn test_unsigned_chat_group_hdr() -> Result<()> {
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
let bob_id = Contact::create(alice, "Bob", &bob_addr).await?;
let bob_id = alice.add_or_lookup_contact_id(bob).await;
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "foos").await?;
add_contact_to_chat(alice, alice_chat_id, bob_id).await?;
send_text_msg(alice, alice_chat_id, "populate".to_string()).await?;
@@ -4153,100 +4153,101 @@ async fn test_ignore_outdated_membership_changes() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_dont_recreate_contacts_on_add_remove() -> Result<()> {
let alice = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let fiona = &tcm.fiona().await;
let charlie = &tcm.charlie().await;
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "bob", "bob@example.net").await?,
alice.add_or_lookup_contact_id(bob).await,
)
.await?;
send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?;
send_text_msg(alice, alice_chat_id, "populate".to_string()).await?;
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
bob_chat_id.accept(&bob).await?;
bob_chat_id.accept(bob).await?;
// alice adds a member
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "fiona", "fiona@example.net").await?,
alice.add_or_lookup_contact_id(fiona).await,
)
.await?;
// bob adds a member.
let bob_blue = Contact::create(&bob, "blue", "blue@example.net").await?;
add_contact_to_chat(&bob, bob_chat_id, bob_blue).await?;
// Bob adds a member.
let bob_charlie = bob.add_or_lookup_contact_id(charlie).await;
add_contact_to_chat(bob, bob_chat_id, bob_charlie).await?;
alice.recv_msg(&bob.pop_sent_msg().await).await;
// Bob didn't receive the addition of Fiona, but Alice mustn't remove Fiona from the members
// list back. Instead, Bob must add Fiona from the next Alice's message to make their group
// members view consistent.
assert_eq!(get_chat_contacts(&alice, alice_chat_id).await?.len(), 4);
assert_eq!(get_chat_contacts(alice, alice_chat_id).await?.len(), 4);
// Just a dumb check for remove_contact_from_chat(). Let's have it in this only place.
remove_contact_from_chat(&bob, bob_chat_id, bob_blue).await?;
remove_contact_from_chat(bob, bob_chat_id, bob_charlie).await?;
alice.recv_msg(&bob.pop_sent_msg().await).await;
assert_eq!(get_chat_contacts(&alice, alice_chat_id).await?.len(), 3);
assert_eq!(get_chat_contacts(alice, alice_chat_id).await?.len(), 3);
SystemTime::shift(Duration::from_secs(3600));
send_text_msg(
&alice,
alice_chat_id,
"Finally add Fiona please".to_string(),
)
.await?;
send_text_msg(alice, alice_chat_id, "Finally add Fiona please".to_string()).await?;
bob.recv_msg(&alice.pop_sent_msg().await).await;
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 3);
assert_eq!(get_chat_contacts(bob, bob_chat_id).await?.len(), 3);
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_delayed_removal_is_ignored() -> Result<()> {
let alice = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let fiona = TestContext::new_fiona().await;
let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let alice_bob = alice.add_or_lookup_contact_id(&bob).await;
let alice_fiona = alice.add_or_lookup_contact_id(&fiona).await;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let fiona = &tcm.fiona().await;
let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
let alice_bob = alice.add_or_lookup_contact_id(bob).await;
let alice_fiona = alice.add_or_lookup_contact_id(fiona).await;
// create chat with three members
add_to_chat_contacts_table(&alice, time(), chat_id, &[alice_bob, alice_fiona]).await?;
add_to_chat_contacts_table(alice, time(), chat_id, &[alice_bob, alice_fiona]).await?;
send_text_msg(&alice, chat_id, "populate".to_string()).await?;
send_text_msg(alice, chat_id, "populate".to_string()).await?;
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
bob_chat_id.accept(&bob).await?;
bob_chat_id.accept(bob).await?;
// Bob removes Fiona.
let bob_contact_fiona = bob.add_or_lookup_contact_id(&fiona).await;
remove_contact_from_chat(&bob, bob_chat_id, bob_contact_fiona).await?;
let bob_contact_fiona = bob.add_or_lookup_contact_id(fiona).await;
remove_contact_from_chat(bob, bob_chat_id, bob_contact_fiona).await?;
let remove_msg = bob.pop_sent_msg().await;
// Bob adds new members "blue" and "orange", but first addition message is lost.
let bob_blue = Contact::create(&bob, "blue", "blue@example.net").await?;
add_contact_to_chat(&bob, bob_chat_id, bob_blue).await?;
// Bob adds new members Dom and Elena, but first addition message is lost.
let dom = &tcm.dom().await;
let elena = &tcm.elena().await;
let bob_dom = bob.add_or_lookup_contact_id(dom).await;
add_contact_to_chat(bob, bob_chat_id, bob_dom).await?;
bob.pop_sent_msg().await;
let bob_orange = Contact::create(&bob, "orange", "orange@example.net").await?;
add_contact_to_chat(&bob, bob_chat_id, bob_orange).await?;
let bob_elena = bob.add_or_lookup_contact_id(elena).await;
add_contact_to_chat(bob, bob_chat_id, bob_elena).await?;
let add_msg = bob.pop_sent_msg().await;
// Alice only receives the second member addition,
// but this results in addition of both members
// and removal of Fiona.
alice.recv_msg(&add_msg).await;
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 4);
assert_eq!(get_chat_contacts(alice, chat_id).await?.len(), 4);
// Alice re-adds Fiona.
add_contact_to_chat(&alice, chat_id, alice_fiona).await?;
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 5);
add_contact_to_chat(alice, chat_id, alice_fiona).await?;
assert_eq!(get_chat_contacts(alice, chat_id).await?.len(), 5);
// Delayed removal of Fiona by Bob shouldn't remove her.
alice.recv_msg(&remove_msg).await;
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 5);
assert_eq!(get_chat_contacts(alice, chat_id).await?.len(), 5);
alice
.golden_test_chat(chat_id, "receive_imf_delayed_removal_is_ignored")
@@ -4258,41 +4259,42 @@ async fn test_delayed_removal_is_ignored() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_dont_readd_with_normal_msg() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = tcm.alice().await;
let bob = tcm.bob().await;
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let fiona = &tcm.fiona().await;
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "bob", "bob@example.net").await?,
alice.add_or_lookup_contact_id(bob).await,
)
.await?;
send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?;
send_text_msg(alice, alice_chat_id, "populate".to_string()).await?;
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
bob_chat_id.accept(&bob).await?;
bob_chat_id.accept(bob).await?;
// Bob leaves, but Alice didn't receive Bob's leave message.
remove_contact_from_chat(&bob, bob_chat_id, ContactId::SELF).await?;
remove_contact_from_chat(bob, bob_chat_id, ContactId::SELF).await?;
bob.pop_sent_msg().await;
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 1);
assert_eq!(get_chat_contacts(bob, bob_chat_id).await?.len(), 1);
SystemTime::shift(Duration::from_secs(3600));
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "fiora", "fiora@example.net").await?,
alice.add_or_lookup_contact_id(fiona).await,
)
.await?;
bob.recv_msg(&alice.pop_sent_msg().await).await;
// Bob received a message from Alice, but this should not re-add him to the group.
assert!(!is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
assert!(!is_contact_in_chat(bob, bob_chat_id, ContactId::SELF).await?);
// Bob got an update that fiora is added nevertheless.
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 2);
// Bob got an update that Fiona is added nevertheless.
assert_eq!(get_chat_contacts(bob, bob_chat_id).await?.len(), 2);
Ok(())
}
@@ -4496,16 +4498,17 @@ async fn test_mua_can_readd() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_member_left_does_not_create_chat() -> Result<()> {
let alice = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "bob", &bob.get_config(Config::Addr).await?.unwrap()).await?,
alice.add_or_lookup_contact_id(bob).await,
)
.await?;
send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?;
send_text_msg(alice, alice_chat_id, "populate".to_string()).await?;
alice.pop_sent_msg().await;
// Bob only received a message of Alice leaving the group.
@@ -4515,7 +4518,7 @@ async fn test_member_left_does_not_create_chat() -> Result<()> {
// especially the chats that were created due to "split group" bugs
// which some members simply deleted and some members left,
// recreating the chat for others.
remove_contact_from_chat(&alice, alice_chat_id, ContactId::SELF).await?;
remove_contact_from_chat(alice, alice_chat_id, ContactId::SELF).await?;
bob.recv_msg_trash(&alice.pop_sent_msg().await).await;
Ok(())
@@ -4523,44 +4526,45 @@ async fn test_member_left_does_not_create_chat() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_recreate_member_list_on_missing_add_of_self() -> Result<()> {
let alice = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let alice_chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let alice_chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(
&alice,
alice,
alice_chat_id,
Contact::create(&alice, "bob", &bob.get_config(Config::Addr).await?.unwrap()).await?,
alice.add_or_lookup_contact_id(bob).await,
)
.await?;
send_text_msg(&alice, alice_chat_id, "populate".to_string()).await?;
send_text_msg(alice, alice_chat_id, "populate".to_string()).await?;
alice.pop_sent_msg().await;
send_text_msg(&alice, alice_chat_id, "second message".to_string()).await?;
send_text_msg(alice, alice_chat_id, "second message".to_string()).await?;
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
assert!(!bob_chat_id.is_special());
// Bob missed the message adding them, but must recreate the member list.
assert_eq!(get_chat_contacts(&bob, bob_chat_id).await?.len(), 2);
assert!(is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
assert_eq!(get_chat_contacts(bob, bob_chat_id).await?.len(), 2);
assert!(is_contact_in_chat(bob, bob_chat_id, ContactId::SELF).await?);
// But if Bob just left, they mustn't recreate the member list even after missing a message.
bob_chat_id.accept(&bob).await?;
remove_contact_from_chat(&bob, bob_chat_id, ContactId::SELF).await?;
bob_chat_id.accept(bob).await?;
remove_contact_from_chat(bob, bob_chat_id, ContactId::SELF).await?;
bob.pop_sent_msg().await;
send_text_msg(&alice, alice_chat_id, "3rd message".to_string()).await?;
send_text_msg(alice, alice_chat_id, "3rd message".to_string()).await?;
alice.pop_sent_msg().await;
send_text_msg(&alice, alice_chat_id, "4th message".to_string()).await?;
send_text_msg(alice, alice_chat_id, "4th message".to_string()).await?;
bob.recv_msg(&alice.pop_sent_msg().await).await;
assert!(!is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
assert!(!is_contact_in_chat(bob, bob_chat_id, ContactId::SELF).await?);
// Even if some time passed, Bob must not be re-added back.
SystemTime::shift(Duration::from_secs(3600));
send_text_msg(&alice, alice_chat_id, "5th message".to_string()).await?;
send_text_msg(alice, alice_chat_id, "5th message".to_string()).await?;
alice.pop_sent_msg().await;
send_text_msg(&alice, alice_chat_id, "6th message".to_string()).await?;
send_text_msg(alice, alice_chat_id, "6th message".to_string()).await?;
bob.recv_msg(&alice.pop_sent_msg().await).await;
assert!(!is_contact_in_chat(&bob, bob_chat_id, ContactId::SELF).await?);
assert!(!is_contact_in_chat(bob, bob_chat_id, ContactId::SELF).await?);
Ok(())
}
@@ -5133,7 +5137,7 @@ async fn test_references() -> Result<()> {
.send_text(alice_chat_id, "Hi! I created a group.")
.await;
let alice_bob_contact_id = Contact::create(alice, "Bob", "bob@example.net").await?;
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?;
let sent = alice.pop_sent_msg().await;
let bob_received_msg = bob.recv_msg(&sent).await;

View File

@@ -715,7 +715,7 @@ async fn test_unknown_sender() -> Result<()> {
let sent = bob.send_text(bob_chat_id, "Hi hi!").await;
let alice_bob_contact_id = Contact::create(&alice, "Bob", "bob@example.net").await?;
let alice_bob_contact_id = alice.add_or_lookup_contact_id(&bob).await;
remove_contact_from_chat(&alice, alice_chat_id, alice_bob_contact_id).await?;
alice.pop_sent_msg().await;

View File

@@ -1745,29 +1745,30 @@ async fn helper_send_receive_status_update(
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_webxdc_reject_updates_from_non_groupmembers() -> Result<()> {
let alice = TestContext::new_alice().await;
let bob = TestContext::new_bob().await;
let contact_bob = Contact::create(&alice, "Bob", "bob@example.net").await?;
let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(&alice, chat_id, contact_bob).await?;
let instance = send_webxdc_instance(&alice, chat_id).await?;
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;
let contact_bob = alice.add_or_lookup_contact_id(bob).await;
let chat_id = create_group_chat(alice, ProtectionStatus::Unprotected, "Group").await?;
add_contact_to_chat(alice, chat_id, contact_bob).await?;
let instance = send_webxdc_instance(alice, chat_id).await?;
bob.recv_msg(&alice.pop_sent_msg().await).await;
let bob_instance = bob.get_last_msg().await;
Chat::load_from_db(&bob, bob_instance.chat_id)
Chat::load_from_db(bob, bob_instance.chat_id)
.await?
.id
.accept(&bob)
.accept(bob)
.await?;
let status = helper_send_receive_status_update(&bob, &alice, &bob_instance, &instance).await?;
let status = helper_send_receive_status_update(bob, alice, &bob_instance, &instance).await?;
assert_eq!(
status,
r#"[{"payload":7,"info":"i","summary":"s","serial":1,"max_serial":1}]"#
);
remove_contact_from_chat(&alice, chat_id, contact_bob).await?;
remove_contact_from_chat(alice, chat_id, contact_bob).await?;
alice.pop_sent_msg().await;
let status = helper_send_receive_status_update(&bob, &alice, &bob_instance, &instance).await?;
let status = helper_send_receive_status_update(bob, alice, &bob_instance, &instance).await?;
assert_eq!(
status,

View File

@@ -1,9 +1,9 @@
Group#Chat#10: Group [5 member(s)]
--------------------------------------------------------------------------------
Msg#10🔒: Me (Contact#Contact#Self): populate √
Msg#11: info (Contact#Contact#Info): Member blue@example.net added. [NOTICED][INFO]
Msg#11: info (Contact#Contact#Info): Member dom@example.net added. [NOTICED][INFO]
Msg#12: info (Contact#Contact#Info): Member fiona@example.net removed. [NOTICED][INFO]
Msg#13: (Contact#Contact#10): Member orange@example.net added by bob@example.net. [FRESH][INFO]
Msg#14: Me (Contact#Contact#Self): You added member fiona@example.net. [INFO] o
Msg#13🔒: (Contact#Contact#10): Member elena@example.net added by bob@example.net. [FRESH][INFO]
Msg#14🔒: Me (Contact#Contact#Self): You added member fiona@example.net. [INFO] o
Msg#15🔒: (Contact#Contact#10): Member fiona@example.net removed by bob@example.net. [FRESH][INFO]
--------------------------------------------------------------------------------