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

Function test_html_message

python/tests/test_1_online.py:121–161  ·  view source on GitHub ↗
(acfactory, lp)

Source from the content-addressed store, hash-verified

119
120
121def test_html_message(acfactory, lp):
122 ac1, ac2 = acfactory.get_online_accounts(2)
123 chat = acfactory.get_accepted_chat(ac1, ac2)
124 html_text = "<p>hello HTML world</p>"
125
126 lp.sec("ac1: prepare and send text message to ac2")
127 msg1 = chat.send_text("message0")
128 assert not msg1.has_html()
129 assert not msg1.html
130
131 lp.sec("wait for ac2 to receive message")
132 msg2 = ac2._evtracker.wait_next_incoming_message()
133 assert msg2.text == "message0"
134 assert not msg2.has_html()
135 assert not msg2.html
136
137 lp.sec("ac1: prepare and send HTML+text message to ac2")
138 msg1 = Message.new_empty(ac1, "text")
139 msg1.set_text("message1")
140 msg1.set_html(html_text)
141 msg1 = chat.send_msg(msg1)
142 assert msg1.has_html()
143 assert html_text in msg1.html
144
145 lp.sec("wait for ac2 to receive message")
146 msg2 = ac2._evtracker.wait_next_incoming_message()
147 assert msg2.text == "message1"
148 assert msg2.has_html()
149 assert html_text in msg2.html
150
151 lp.sec("ac1: prepare and send HTML-only message to ac2")
152 msg1 = Message.new_empty(ac1, "text")
153 msg1.set_html(html_text)
154 msg1 = chat.send_msg(msg1)
155
156 lp.sec("wait for ac2 to receive message")
157 msg2 = ac2._evtracker.wait_next_incoming_message()
158 assert "<p>" not in msg2.text
159 assert "hello HTML world" in msg2.text
160 assert msg2.has_html()
161 assert html_text in msg2.html
162
163
164def test_webxdc_message(acfactory, data, lp):

Callers

nothing calls this directly

Calls 10

secMethod · 0.80
new_emptyMethod · 0.80
get_online_accountsMethod · 0.45
get_accepted_chatMethod · 0.45
send_textMethod · 0.45
has_htmlMethod · 0.45
set_textMethod · 0.45
set_htmlMethod · 0.45
send_msgMethod · 0.45

Tested by

no test coverage detected