mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
test: port test_aeap_flow_verified to JSON-RPC
This commit is contained in:
@@ -387,3 +387,45 @@ def test_qr_new_group_unblocked(acfactory):
|
|||||||
ac2_msg = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
ac2_msg = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
assert ac2_msg.text == "Hello!"
|
assert ac2_msg.text == "Hello!"
|
||||||
assert ac2_msg.chat.get_basic_snapshot().is_contact_request
|
assert ac2_msg.chat.get_basic_snapshot().is_contact_request
|
||||||
|
|
||||||
|
|
||||||
|
def test_aeap_flow_verified(acfactory):
|
||||||
|
"""Test that a new address is added to a contact when it changes its address."""
|
||||||
|
ac1, ac2, ac1new = acfactory.get_online_accounts(3)
|
||||||
|
|
||||||
|
logging.info("ac1: create verified-group QR, ac2 scans and joins")
|
||||||
|
chat = ac1.create_group("hello", protect=True)
|
||||||
|
assert chat.get_basic_snapshot().is_protected
|
||||||
|
qr_code, _svg = chat.get_qr_code()
|
||||||
|
logging.info("ac2: start QR-code based join-group protocol")
|
||||||
|
ac2.secure_join(qr_code)
|
||||||
|
ac1.wait_for_securejoin_inviter_success()
|
||||||
|
|
||||||
|
logging.info("sending first message")
|
||||||
|
msg_out = chat.send_text("old address").get_snapshot()
|
||||||
|
|
||||||
|
logging.info("receiving first message")
|
||||||
|
ac2.wait_for_incoming_msg_event() # member added message
|
||||||
|
msg_in_1 = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
|
assert msg_in_1.text == msg_out.text
|
||||||
|
|
||||||
|
logging.info("changing email account")
|
||||||
|
ac1.set_config("addr", ac1new.get_config("addr"))
|
||||||
|
ac1.set_config("mail_pw", ac1new.get_config("mail_pw"))
|
||||||
|
ac1.stop_io()
|
||||||
|
ac1.configure()
|
||||||
|
ac1.start_io()
|
||||||
|
|
||||||
|
logging.info("sending second message")
|
||||||
|
msg_out = chat.send_text("changed address").get_snapshot()
|
||||||
|
|
||||||
|
logging.info("receiving second message")
|
||||||
|
msg_in_2 = ac2.get_message_by_id(ac2.wait_for_incoming_msg_event().msg_id)
|
||||||
|
msg_in_2_snapshot = msg_in_2.get_snapshot()
|
||||||
|
assert msg_in_2_snapshot.text == msg_out.text
|
||||||
|
assert msg_in_2_snapshot.chat.id == msg_in_1.chat.id
|
||||||
|
assert msg_in_2.get_sender_contact().get_snapshot().address == ac1new.get_config("addr")
|
||||||
|
assert len(msg_in_2_snapshot.chat.get_contacts()) == 2
|
||||||
|
assert ac1new.get_config("addr") in [
|
||||||
|
contact.get_snapshot().address for contact in msg_in_2_snapshot.chat.get_contacts()
|
||||||
|
]
|
||||||
|
|||||||
@@ -2405,47 +2405,6 @@ def test_delete_deltachat_folder(acfactory):
|
|||||||
assert "DeltaChat" in ac1.direct_imap.list_folders()
|
assert "DeltaChat" in ac1.direct_imap.list_folders()
|
||||||
|
|
||||||
|
|
||||||
def test_aeap_flow_verified(acfactory, lp):
|
|
||||||
"""Test that a new address is added to a contact when it changes its address."""
|
|
||||||
ac1, ac2, ac1new = acfactory.get_online_accounts(3)
|
|
||||||
|
|
||||||
lp.sec("ac1: create verified-group QR, ac2 scans and joins")
|
|
||||||
chat = ac1.create_group_chat("hello", verified=True)
|
|
||||||
assert chat.is_protected()
|
|
||||||
qr = chat.get_join_qr()
|
|
||||||
lp.sec("ac2: start QR-code based join-group protocol")
|
|
||||||
chat2 = ac2.qr_join_chat(qr)
|
|
||||||
assert chat2.id >= 10
|
|
||||||
ac1._evtracker.wait_securejoin_inviter_progress(1000)
|
|
||||||
|
|
||||||
lp.sec("sending first message")
|
|
||||||
msg_out = chat.send_text("old address")
|
|
||||||
|
|
||||||
lp.sec("receiving first message")
|
|
||||||
ac2._evtracker.wait_next_incoming_message() # member added message
|
|
||||||
msg_in_1 = ac2._evtracker.wait_next_incoming_message()
|
|
||||||
assert msg_in_1.text == msg_out.text
|
|
||||||
|
|
||||||
lp.sec("changing email account")
|
|
||||||
ac1.set_config("addr", ac1new.get_config("addr"))
|
|
||||||
ac1.set_config("mail_pw", ac1new.get_config("mail_pw"))
|
|
||||||
ac1.stop_io()
|
|
||||||
configtracker = ac1.configure()
|
|
||||||
configtracker.wait_finish()
|
|
||||||
ac1.start_io()
|
|
||||||
|
|
||||||
lp.sec("sending second message")
|
|
||||||
msg_out = chat.send_text("changed address")
|
|
||||||
|
|
||||||
lp.sec("receiving second message")
|
|
||||||
msg_in_2 = ac2._evtracker.wait_next_incoming_message()
|
|
||||||
assert msg_in_2.text == msg_out.text
|
|
||||||
assert msg_in_2.chat.id == msg_in_1.chat.id
|
|
||||||
assert msg_in_2.get_sender_contact().addr == ac1new.get_config("addr")
|
|
||||||
assert len(msg_in_2.chat.get_contacts()) == 2
|
|
||||||
assert ac1new.get_config("addr") in [contact.addr for contact in msg_in_2.chat.get_contacts()]
|
|
||||||
|
|
||||||
|
|
||||||
def test_archived_muted_chat(acfactory, lp):
|
def test_archived_muted_chat(acfactory, lp):
|
||||||
"""If an archived and muted chat receives a new message, DC_EVENT_MSGS_CHANGED for
|
"""If an archived and muted chat receives a new message, DC_EVENT_MSGS_CHANGED for
|
||||||
DC_CHAT_ID_ARCHIVED_LINK must be generated if the chat had only seen messages previously.
|
DC_CHAT_ID_ARCHIVED_LINK must be generated if the chat had only seen messages previously.
|
||||||
|
|||||||
Reference in New Issue
Block a user