Skip to content

Commit 059cf7d

Browse files
committed
restore test_download_on_demand
1 parent aae7f55 commit 059cf7d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

deltachat-rpc-client/tests/test_chatlist_events.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,40 @@ def test_delivery_status_failed(acfactory: ACFactory) -> None:
109109
assert failing_message.get_snapshot().state == const.MessageState.OUT_FAILED
110110

111111

112+
def test_download_on_demand(acfactory: ACFactory) -> None:
113+
"""
114+
Test if download on demand emits chatlist update events.
115+
This is only needed for last message in chat, but finding that out is too expensive, so it's always emitted
116+
"""
117+
alice, bob = acfactory.get_online_accounts(2)
118+
119+
alice_contact_bob = alice.create_contact(bob, "Bob")
120+
alice_chat_bob = alice_contact_bob.create_chat()
121+
alice_chat_bob.send_text("hi")
122+
123+
alice.set_config("download_limit", "1")
124+
125+
msg = bob.wait_for_incoming_msg()
126+
chat_id = msg.get_snapshot().chat_id
127+
msg.get_snapshot().chat.accept()
128+
bob.get_chat_by_id(chat_id).send_message(
129+
"Hello World, this message is bigger than 5 bytes",
130+
file="../test-data/image/screenshot.jpg",
131+
)
132+
133+
message = alice.wait_for_incoming_msg()
134+
snapshot = message.get_snapshot()
135+
assert snapshot.download_state == const.DownloadState.AVAILABLE
136+
137+
alice.clear_all_events()
138+
139+
snapshot = message.get_snapshot()
140+
chat_id = snapshot.chat_id
141+
alice._rpc.download_full_message(alice.id, message.id)
142+
143+
wait_for_chatlist_specific_item(alice, chat_id)
144+
145+
112146
def get_multi_account_test_setup(acfactory: ACFactory) -> [Account, Account, Account]:
113147
alice, bob = acfactory.get_online_accounts(2)
114148

0 commit comments

Comments
 (0)