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

Function test_group_quote

python/tests/test_1_online.py:1209–1245  ·  view source on GitHub ↗

Test quoting in a group with a new member who have not seen the quoted message.

(acfactory, lp)

Source from the content-addressed store, hash-verified

1207
1208
1209def test_group_quote(acfactory, lp):
1210 """Test quoting in a group with a new member who have not seen the quoted message."""
1211 ac1, ac2, ac3 = accounts = acfactory.get_online_accounts(3)
1212 acfactory.introduce_each_other(accounts)
1213 chat = ac1.create_group_chat(name="quote group")
1214 chat.add_contact(ac2)
1215
1216 lp.sec("ac1: sending message")
1217 out_msg = chat.send_text("hello")
1218
1219 lp.sec("ac2: receiving message")
1220 msg = ac2._evtracker.wait_next_incoming_message()
1221 assert msg.text == "hello"
1222
1223 chat.add_contact(ac3)
1224 ac2._evtracker.wait_next_incoming_message()
1225 ac3._evtracker.wait_next_incoming_message()
1226
1227 lp.sec("ac2: sending reply with a quote")
1228 reply_msg = Message.new_empty(msg.chat.account, "text")
1229 reply_msg.set_text("reply")
1230 reply_msg.quote = msg
1231 assert reply_msg.quoted_text == "hello"
1232 msg.chat.send_msg(reply_msg)
1233
1234 lp.sec("ac3: receiving reply")
1235 received_reply = ac3._evtracker.wait_next_incoming_message()
1236 assert received_reply.text == "reply"
1237 assert received_reply.quoted_text == "hello"
1238 # ac3 was not in the group and has not received quoted message
1239 assert received_reply.quote is None
1240
1241 lp.sec("ac1: receiving reply")
1242 received_reply = ac1._evtracker.wait_next_incoming_message()
1243 assert received_reply.text == "reply"
1244 assert received_reply.quoted_text == "hello"
1245 assert received_reply.quote.id == out_msg.id
1246
1247
1248def test_archived_muted_chat(acfactory, lp):

Callers

nothing calls this directly

Calls 10

introduce_each_otherMethod · 0.80
secMethod · 0.80
new_emptyMethod · 0.80
get_online_accountsMethod · 0.45
create_group_chatMethod · 0.45
add_contactMethod · 0.45
send_textMethod · 0.45
set_textMethod · 0.45
send_msgMethod · 0.45

Tested by

no test coverage detected