MCPcopy Create free account
hub / github.com/chatmail/core / test_status

Function test_status

python/tests/test_1_online.py:1175–1206  ·  view source on GitHub ↗

Test that status is transferred over the network.

(acfactory)

Source from the content-addressed store, hash-verified

1173
1174
1175def test_status(acfactory):
1176 """Test that status is transferred over the network."""
1177 ac1, ac2 = acfactory.get_online_accounts(2)
1178
1179 chat12 = acfactory.get_accepted_chat(ac1, ac2)
1180 ac1.set_config("selfstatus", "New status")
1181 chat12.send_text("hi")
1182 msg_received = ac2._evtracker.wait_next_incoming_message()
1183 assert msg_received.text == "hi"
1184 assert msg_received.get_sender_contact().status == "New status"
1185
1186 # Send a reply from ac2 to ac1 so ac1 can send a read receipt.
1187 reply_msg = msg_received.chat.send_text("reply")
1188 reply_msg_received = ac1._evtracker.wait_next_incoming_message()
1189 assert reply_msg_received.text == "reply"
1190
1191 # Send read receipt from ac1 to ac2.
1192 # It does not contain the signature.
1193 ac1.mark_seen_messages([reply_msg_received])
1194 ev = ac2._evtracker.get_matching("DC_EVENT_MSG_READ")
1195 assert ev.data1 == reply_msg.chat.id
1196 assert ev.data2 == reply_msg.id
1197 assert reply_msg.is_out_mdn_received()
1198
1199 # Test that the status is not cleared as a result of receiving a read receipt.
1200 assert msg_received.get_sender_contact().status == "New status"
1201
1202 ac1.set_config("selfstatus", "")
1203 chat12.send_text("hello")
1204 msg = ac2._evtracker.wait_next_incoming_message()
1205 assert msg.text == "hello"
1206 assert not msg.get_sender_contact().status
1207
1208
1209def test_group_quote(acfactory, lp):

Callers

nothing calls this directly

Calls 9

is_out_mdn_receivedMethod · 0.80
get_online_accountsMethod · 0.45
get_accepted_chatMethod · 0.45
set_configMethod · 0.45
send_textMethod · 0.45
get_sender_contactMethod · 0.45
mark_seen_messagesMethod · 0.45
get_matchingMethod · 0.45

Tested by

no test coverage detected