aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_linkifytext.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-08-01 15:25:25 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-08-01 15:57:54 +0200
commit40c937f894d2968774dab41ddff02fd6a8c0dd5f (patch)
tree41258138c0073f5d702c6abf1b3a557eba44e1eb /_pytest/test_linkifytext.py
parent2b3b969dffcaee7d2dfe23d4bcedf57c685567dc (diff)
downloadwee-slack-40c937f894d2968774dab41ddff02fd6a8c0dd5f.tar.gz
Fix HTML entity-encoding of outgoing messages
We have to replace the & before we replace < and >, otherwise the & in &lt; and &gt; are going to be replaced. Additionally, we need to end the sequences with ; which was missing.
Diffstat (limited to '_pytest/test_linkifytext.py')
-rw-r--r--_pytest/test_linkifytext.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/_pytest/test_linkifytext.py b/_pytest/test_linkifytext.py
index f9da3f9..010a48b 100644
--- a/_pytest/test_linkifytext.py
+++ b/_pytest/test_linkifytext.py
@@ -4,3 +4,12 @@ from wee_slack import linkify_text
# linkify_text('@ryan')
# assert False
+
+
+def test_linkifytext_does_partial_html_entity_encoding(mock_weechat, realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('& < > \' "', team, channel)
+
+ assert text == '&amp; &lt; &gt; \' "'