Skip to content

Commit

Permalink
test: wait for joiner success in test_verified_group_[member_added]_r…
Browse files Browse the repository at this point in the history
…ecovery

If we wait for inviter success,
vg-member-added message may be still in flight
and reach ac2 after device resetup.

Making ac2 wait for joining the group ensures that old
device receives vg-member-added message
and new device will not receive it and fail to decrypt.

Other instances of wait_for_securejoin_inviter_success()
in the same tests are also replaced for reliability.
  • Loading branch information
link2xt committed Jan 18, 2024
1 parent 6cfe3e6 commit e67e684
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions deltachat-rpc-client/tests/test_securejoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,24 @@ def test_verified_group_recovery(acfactory) -> None:
logging.info("ac2 joins verified group")
qr_code, _svg = chat.get_qr_code()
ac2.secure_join(qr_code)
ac1.wait_for_securejoin_inviter_success()
ac2.wait_for_securejoin_joiner_success()

# ac1 has ac2 directly verified.
ac1_contact_ac2 = ac1.get_contact_by_addr(ac2.get_config("addr"))
assert ac1_contact_ac2.get_snapshot().verifier_id == SpecialContactId.SELF

logging.info("ac3 joins verified group")
ac3_chat = ac3.secure_join(qr_code)
ac1.wait_for_securejoin_inviter_success()
ac3.wait_for_securejoin_joiner_success()
ac3.wait_for_incoming_msg_event() # Member added

logging.info("ac2 logs in on a new device")
ac2 = acfactory.resetup_account(ac2)

logging.info("ac2 reverifies with ac3")
qr_code, _svg = ac3.get_qr_code()
ac2.secure_join(qr_code)

ac3.wait_for_securejoin_inviter_success()
ac2.wait_for_securejoin_joiner_success()

logging.info("ac3 sends a message to the group")
assert len(ac3_chat.get_contacts()) == 3
Expand Down Expand Up @@ -239,24 +239,24 @@ def test_verified_group_member_added_recovery(acfactory) -> None:
logging.info("ac2 joins verified group")
qr_code, _svg = chat.get_qr_code()
ac2.secure_join(qr_code)
ac1.wait_for_securejoin_inviter_success()
ac2.wait_for_securejoin_joiner_success()

# ac1 has ac2 directly verified.
ac1_contact_ac2 = ac1.get_contact_by_addr(ac2.get_config("addr"))
assert ac1_contact_ac2.get_snapshot().verifier_id == SpecialContactId.SELF

logging.info("ac3 joins verified group")
ac3_chat = ac3.secure_join(qr_code)
ac1.wait_for_securejoin_inviter_success()
ac3.wait_for_securejoin_joiner_success()
ac3.wait_for_incoming_msg_event() # Member added

logging.info("ac2 logs in on a new device")
ac2 = acfactory.resetup_account(ac2)

logging.info("ac2 reverifies with ac3")
qr_code, _svg = ac3.get_qr_code()
ac2.secure_join(qr_code)

ac3.wait_for_securejoin_inviter_success()
ac2.wait_for_securejoin_joiner_success()

logging.info("ac3 sends a message to the group")
assert len(ac3_chat.get_contacts()) == 3
Expand Down

0 comments on commit e67e684

Please sign in to comment.