Skip to content

Commit 94e75cb

Browse files
committed
test: add online test for read receipts
1 parent c7fb64e commit 94e75cb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

deltachat-rpc-client/tests/test_something.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,26 @@ def test_markseen_contact_request(acfactory):
726726
assert message2.get_snapshot().state == MessageState.IN_SEEN
727727

728728

729+
def test_read_receipt(acfactory):
730+
"""
731+
Test sending a read receipt and ensure it is attributed to the correct contact.
732+
"""
733+
alice, bob = acfactory.get_online_accounts(2)
734+
735+
alice_chat_bob = alice.create_chat(bob)
736+
alice_contact_bob = alice.create_contact(bob)
737+
bob.create_chat(alice) # Accept the chat
738+
739+
alice_chat_bob.send_text("Hello Bob!")
740+
msg = bob.wait_for_incoming_msg()
741+
msg.mark_seen()
742+
743+
read_msg = alice.get_message_by_id(alice.wait_for_event(EventType.MSG_READ).msg_id)
744+
read_receipts = read_msg.get_read_receipts()
745+
assert len(read_receipts) == 1
746+
assert read_receipts[0].contact_id == alice_contact_bob.id
747+
748+
729749
def test_get_http_response(acfactory):
730750
alice = acfactory.new_configured_account()
731751
http_response = alice._rpc.get_http_response(alice.id, "https://example.org")

0 commit comments

Comments
 (0)