@@ -16,14 +16,14 @@ def test_qr_setup_contact(acfactory, tmp_path) -> None:
16
16
alice .wait_for_securejoin_inviter_success ()
17
17
18
18
# Test that Alice verified Bob's profile.
19
- alice_contact_bob = alice .get_contact_by_addr (bob . get_config ( "addr" ) )
19
+ alice_contact_bob = alice .create_contact (bob )
20
20
alice_contact_bob_snapshot = alice_contact_bob .get_snapshot ()
21
21
assert alice_contact_bob_snapshot .is_verified
22
22
23
23
bob .wait_for_securejoin_joiner_success ()
24
24
25
25
# Test that Bob verified Alice's profile.
26
- bob_contact_alice = bob .get_contact_by_addr ( alice . get_config ( "addr" ) )
26
+ bob_contact_alice = bob .create_contact ( bob )
27
27
bob_contact_alice_snapshot = bob_contact_alice .get_snapshot ()
28
28
assert bob_contact_alice_snapshot .is_verified
29
29
@@ -84,7 +84,7 @@ def test_qr_securejoin(acfactory, protect):
84
84
bob .wait_for_securejoin_joiner_success ()
85
85
86
86
# Test that Alice verified Bob's profile.
87
- alice_contact_bob = alice .get_contact_by_addr (bob . get_config ( "addr" ) )
87
+ alice_contact_bob = alice .create_contact (bob )
88
88
alice_contact_bob_snapshot = alice_contact_bob .get_snapshot ()
89
89
assert alice_contact_bob_snapshot .is_verified
90
90
@@ -93,15 +93,15 @@ def test_qr_securejoin(acfactory, protect):
93
93
assert snapshot .chat .get_basic_snapshot ().is_protected == protect
94
94
95
95
# Test that Bob verified Alice's profile.
96
- bob_contact_alice = bob .get_contact_by_addr (alice . get_config ( "addr" ) )
96
+ bob_contact_alice = bob .create_contact (alice )
97
97
bob_contact_alice_snapshot = bob_contact_alice .get_snapshot ()
98
98
assert bob_contact_alice_snapshot .is_verified
99
99
100
100
# Start second Alice device.
101
101
# Alice observes securejoin protocol and verifies Bob on second device.
102
102
alice2 .start_io ()
103
103
alice2 .wait_for_securejoin_inviter_success ()
104
- alice2_contact_bob = alice2 .get_contact_by_addr (bob . get_config ( "addr" ) )
104
+ alice2_contact_bob = alice2 .create_contact (bob )
105
105
alice2_contact_bob_snapshot = alice2_contact_bob .get_snapshot ()
106
106
assert alice2_contact_bob_snapshot .is_verified
107
107
@@ -227,7 +227,7 @@ def test_verified_group_recovery(acfactory) -> None:
227
227
ac2 .wait_for_securejoin_joiner_success ()
228
228
229
229
# ac1 has ac2 directly verified.
230
- ac1_contact_ac2 = ac1 .get_contact_by_addr (ac2 . get_config ( "addr" ) )
230
+ ac1_contact_ac2 = ac1 .create_contact (ac2 )
231
231
assert ac1_contact_ac2 .get_snapshot ().verifier_id == SpecialContactId .SELF
232
232
233
233
logging .info ("ac3 joins verified group" )
@@ -278,7 +278,7 @@ def test_verified_group_recovery(acfactory) -> None:
278
278
279
279
280
280
def test_verified_group_member_added_recovery (acfactory ) -> None :
281
- """Tests verified group recovery by reverifiying than removing and adding a member back."""
281
+ """Tests verified group recovery by reverifying than removing and adding a member back."""
282
282
ac1 , ac2 , ac3 = acfactory .get_online_accounts (3 )
283
283
284
284
logging .info ("ac1 creates verified group" )
@@ -291,7 +291,7 @@ def test_verified_group_member_added_recovery(acfactory) -> None:
291
291
ac2 .wait_for_securejoin_joiner_success ()
292
292
293
293
# ac1 has ac2 directly verified.
294
- ac1_contact_ac2 = ac1 .get_contact_by_addr (ac2 . get_config ( "addr" ) )
294
+ ac1_contact_ac2 = ac1 .create_contact (ac2 )
295
295
assert ac1_contact_ac2 .get_snapshot ().verifier_id == SpecialContactId .SELF
296
296
297
297
logging .info ("ac3 joins verified group" )
@@ -319,7 +319,7 @@ def test_verified_group_member_added_recovery(acfactory) -> None:
319
319
320
320
ac1 .wait_for_incoming_msg_event () # Hi!
321
321
322
- ac3_contact_ac2 = ac3 .get_contact_by_addr (ac2 . get_config ( "addr" ) )
322
+ ac3_contact_ac2 = ac3 .create_contact (ac2 )
323
323
ac3_chat .remove_contact (ac3_contact_ac2 )
324
324
325
325
msg_id = ac2 .wait_for_incoming_msg_event ().msg_id
@@ -354,19 +354,16 @@ def test_verified_group_member_added_recovery(acfactory) -> None:
354
354
snapshot = ac1 .get_message_by_id (ac1 .wait_for_incoming_msg_event ().msg_id ).get_snapshot ()
355
355
assert snapshot .text == "Works again!"
356
356
357
- ac1_contact_ac2 = ac1 .get_contact_by_addr (ac2 .get_config ("addr" ))
357
+ ac1_contact_ac2 = ac1 .create_contact (ac2 )
358
+ ac1_contact_ac3 = ac1 .create_contact (ac3 )
358
359
ac1_contact_ac2_snapshot = ac1_contact_ac2 .get_snapshot ()
359
360
assert ac1_contact_ac2_snapshot .is_verified
360
- assert ac1_contact_ac2_snapshot .verifier_id == ac1 .get_contact_by_addr (ac3 .get_config ("addr" )).id
361
-
362
- # ac2 is now verified by ac3 for ac1
363
- ac1_contact_ac3 = ac1 .get_contact_by_addr (ac3 .get_config ("addr" ))
364
- assert ac1_contact_ac2 .get_snapshot ().verifier_id == ac1_contact_ac3 .id
361
+ assert ac1_contact_ac2_snapshot .verifier_id == ac1_contact_ac3 .id
365
362
366
363
367
364
def test_qr_join_chat_with_pending_bobstate_issue4894 (acfactory ):
368
365
"""Regression test for
369
- issue <https://github.com/deltachat/deltachat- core-rust /issues/4894>.
366
+ issue <https://github.com/chatmail/ core/issues/4894>.
370
367
"""
371
368
ac1 , ac2 , ac3 , ac4 = acfactory .get_online_accounts (4 )
372
369
@@ -400,12 +397,12 @@ def test_qr_join_chat_with_pending_bobstate_issue4894(acfactory):
400
397
logging .info ("ac2 now has pending bobstate but ac1 is shutoff" )
401
398
402
399
# we meanwhile expect ac3/ac2 verification started in the beginning to have completed
403
- assert ac3 .get_contact_by_addr (ac2 . get_config ( "addr" ) ).get_snapshot ().is_verified
404
- assert ac2 .get_contact_by_addr (ac3 . get_config ( "addr" ) ).get_snapshot ().is_verified
400
+ assert ac3 .create_contact (ac2 ).get_snapshot ().is_verified
401
+ assert ac2 .create_contact (ac3 ).get_snapshot ().is_verified
405
402
406
403
logging .info ("ac3: create a verified group VG with ac2" )
407
404
vg = ac3 .create_group ("ac3-created" , protect = True )
408
- vg .add_contact (ac3 .get_contact_by_addr (ac2 . get_config ( "addr" ) ))
405
+ vg .add_contact (ac3 .create_contact (ac2 ))
409
406
410
407
# ensure ac2 receives message in VG
411
408
vg .send_text ("hello" )
@@ -443,7 +440,7 @@ def test_qr_new_group_unblocked(acfactory):
443
440
ac1 .wait_for_securejoin_inviter_success ()
444
441
445
442
ac1_new_chat = ac1 .create_group ("Another group" )
446
- ac1_new_chat .add_contact (ac1 .get_contact_by_addr (ac2 . get_config ( "addr" ) ))
443
+ ac1_new_chat .add_contact (ac1 .create_contact (ac2 ))
447
444
# Receive "Member added" message.
448
445
ac2 .wait_for_incoming_msg_event ()
449
446
0 commit comments