@@ -2093,19 +2093,20 @@ async fn test_forward_group() -> Result<()> {
2093
2093
let mut tcm = TestContextManager :: new ( ) ;
2094
2094
let alice = tcm. alice ( ) . await ;
2095
2095
let bob = tcm. bob ( ) . await ;
2096
+ let charlie = tcm. charlie ( ) . await ;
2096
2097
2097
2098
let alice_chat = alice. create_chat ( & bob) . await ;
2098
2099
let bob_chat = bob. create_chat ( & alice) . await ;
2099
2100
2100
2101
// Alice creates a group with Bob.
2101
2102
let alice_group_chat_id =
2102
2103
create_group_chat ( & alice, ProtectionStatus :: Unprotected , "Group" ) . await ?;
2103
- let bob_id = Contact :: create ( & alice , "Bob" , " bob@example.net" ) . await ? ;
2104
- let claire_id = Contact :: create ( & alice, "Claire" , "claire@example.net" ) . await ? ;
2104
+ let bob_id = alice . add_or_lookup_contact_id ( & bob) . await ;
2105
+ let charlie_id = alice. add_or_lookup_contact_id ( & charlie ) . await ;
2105
2106
add_contact_to_chat ( & alice, alice_group_chat_id, bob_id) . await ?;
2106
- add_contact_to_chat ( & alice, alice_group_chat_id, claire_id ) . await ?;
2107
+ add_contact_to_chat ( & alice, alice_group_chat_id, charlie_id ) . await ?;
2107
2108
let sent_group_msg = alice
2108
- . send_text ( alice_group_chat_id, "Hi Bob and Claire " )
2109
+ . send_text ( alice_group_chat_id, "Hi Bob and Charlie " )
2109
2110
. await ;
2110
2111
let bob_group_chat_id = bob. recv_msg ( & sent_group_msg) . await . chat_id ;
2111
2112
@@ -2388,19 +2389,15 @@ async fn test_resend_own_message() -> Result<()> {
2388
2389
2389
2390
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
2390
2391
async fn test_resend_foreign_message_fails ( ) -> Result < ( ) > {
2391
- let alice = TestContext :: new_alice ( ) . await ;
2392
- let alice_grp = create_group_chat ( & alice, ProtectionStatus :: Unprotected , "grp" ) . await ?;
2393
- add_contact_to_chat (
2394
- & alice,
2395
- alice_grp,
2396
- Contact :: create ( & alice, "" , "bob@example.net" ) . await ?,
2397
- )
2398
- . await ?;
2392
+ let mut tcm = TestContextManager :: new ( ) ;
2393
+ let alice = & tcm. alice ( ) . await ;
2394
+ let bob = & tcm. bob ( ) . await ;
2395
+ let alice_grp = create_group_chat ( alice, ProtectionStatus :: Unprotected , "grp" ) . await ?;
2396
+ add_contact_to_chat ( alice, alice_grp, alice. add_or_lookup_contact_id ( bob) . await ) . await ?;
2399
2397
let sent1 = alice. send_text ( alice_grp, "alice->bob" ) . await ;
2400
2398
2401
- let bob = TestContext :: new_bob ( ) . await ;
2402
2399
let msg = bob. recv_msg ( & sent1) . await ;
2403
- assert ! ( resend_msgs( & bob, & [ msg. id] ) . await . is_err( ) ) ;
2400
+ assert ! ( resend_msgs( bob, & [ msg. id] ) . await . is_err( ) ) ;
2404
2401
2405
2402
Ok ( ( ) )
2406
2403
}
@@ -2444,24 +2441,23 @@ async fn test_resend_opportunistically_encryption() -> Result<()> {
2444
2441
2445
2442
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
2446
2443
async fn test_resend_info_message_fails ( ) -> Result < ( ) > {
2447
- let alice = TestContext :: new_alice ( ) . await ;
2448
- let alice_grp = create_group_chat ( & alice, ProtectionStatus :: Unprotected , "grp" ) . await ?;
2449
- add_contact_to_chat (
2450
- & alice,
2451
- alice_grp,
2452
- Contact :: create ( & alice, "" , "bob@example.net" ) . await ?,
2453
- )
2454
- . await ?;
2444
+ let mut tcm = TestContextManager :: new ( ) ;
2445
+ let alice = & tcm. alice ( ) . await ;
2446
+ let bob = & tcm. bob ( ) . await ;
2447
+ let charlie = & tcm. charlie ( ) . await ;
2448
+
2449
+ let alice_grp = create_group_chat ( alice, ProtectionStatus :: Unprotected , "grp" ) . await ?;
2450
+ add_contact_to_chat ( alice, alice_grp, alice. add_or_lookup_contact_id ( bob) . await ) . await ?;
2455
2451
alice. send_text ( alice_grp, "alice->bob" ) . await ;
2456
2452
2457
2453
add_contact_to_chat (
2458
- & alice,
2454
+ alice,
2459
2455
alice_grp,
2460
- Contact :: create ( & alice, "" , "claire@example.org" ) . await ? ,
2456
+ alice. add_or_lookup_contact_id ( charlie ) . await ,
2461
2457
)
2462
2458
. await ?;
2463
2459
let sent2 = alice. pop_sent_msg ( ) . await ;
2464
- assert ! ( resend_msgs( & alice, & [ sent2. sender_msg_id] ) . await . is_err( ) ) ;
2460
+ assert ! ( resend_msgs( alice, & [ sent2. sender_msg_id] ) . await . is_err( ) ) ;
2465
2461
2466
2462
Ok ( ( ) )
2467
2463
}
0 commit comments