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

Function test_quote_attachment

python/tests/test_1_online.py:658–688  ·  view source on GitHub ↗

Test that replies with an attachment and a quote are received correctly.

(tmp_path, acfactory, lp)

Source from the content-addressed store, hash-verified

656
657
658def test_quote_attachment(tmp_path, acfactory, lp):
659 """Test that replies with an attachment and a quote are received correctly."""
660 ac1, ac2 = acfactory.get_online_accounts(2)
661
662 lp.sec("ac1 creates chat with ac2")
663 chat1 = ac1.create_chat(ac2)
664
665 lp.sec("ac1 sends text message to ac2")
666 chat1.send_text("hi")
667
668 lp.sec("ac2 receives contact request from ac1")
669 received_message = ac2._evtracker.wait_next_incoming_message()
670 assert received_message.text == "hi"
671
672 basename = "attachment.txt"
673 p = tmp_path / basename
674 p.write_text("data to send")
675
676 lp.sec("ac2 sends a reply to ac1")
677 chat2 = received_message.create_chat()
678 reply = Message.new_empty(ac2, "file")
679 reply.set_text("message reply")
680 reply.set_file(str(p))
681 reply.quote = received_message
682 chat2.send_msg(reply)
683
684 lp.sec("ac1 receives a reply from ac2")
685 received_reply = ac1._evtracker.wait_next_incoming_message()
686 assert received_reply.text == "message reply"
687 assert received_reply.quoted_text == received_message.text
688 assert open(received_reply.filename).read() == "data to send"
689
690
691def test_send_mark_seen_clean_incoming_events(acfactory, lp):

Callers

nothing calls this directly

Calls 9

secMethod · 0.80
new_emptyMethod · 0.80
set_fileMethod · 0.80
get_online_accountsMethod · 0.45
create_chatMethod · 0.45
send_textMethod · 0.45
set_textMethod · 0.45
send_msgMethod · 0.45

Tested by

no test coverage detected