aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest
diff options
context:
space:
mode:
authorpasja <pasja@users.noreply.github.com>2018-11-03 21:24:29 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2018-11-03 21:24:29 +0100
commit7e9ef8814fc1e0c374e3f55523c03613902d8327 (patch)
treeff2809ff537c2f9ccca25387dba61059e096bc61 /_pytest
parent584f9e6c5af3ed1be4f9f04cef6f7cec6d845363 (diff)
downloadwee-slack-7e9ef8814fc1e0c374e3f55523c03613902d8327.tar.gz
Match nicks with parenthesis and/or unicode (#649)
* Fix for #570, also incorporates #545 * Fixes from the review * review fix #2
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/test_linkifytext.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/_pytest/test_linkifytext.py b/_pytest/test_linkifytext.py
index 56bf1b5..f321d81 100644
--- a/_pytest/test_linkifytext.py
+++ b/_pytest/test_linkifytext.py
@@ -1,5 +1,10 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+
from wee_slack import linkify_text
+
#def test_linkifytext():
# linkify_text('@ryan')
@@ -13,3 +18,35 @@ def test_linkifytext_does_partial_html_entity_encoding(realish_eventrouter):
text = linkify_text('& < > \' "', team, channel)
assert text == '&amp; &lt; &gt; \' "'
+
+def test_linkifytext_names_with_paranthesis(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('@JohnDoe(jdoe): my test message', team, channel)
+
+ assert text == '@JohnDoe(jdoe): my test message'
+
+def test_linkifytext_names_with_accents(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('@ÁrvíztűrőTükörfúrógép(atukorfurogep): my test message', team, channel)
+
+ assert text == '@ÁrvíztűrőTükörfúrógép(atukorfurogep): my test message'
+
+def test_linkifytext_formatting_characters(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('\x02\x1Dmy test message\x1D\x02', team, channel)
+
+ assert text == '*_my test message_*'
+
+def test_linkifytext_with_many_paranthesis(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('@k(o(v)a)())s: my(( test) message', team, channel)
+
+ assert text == '@k(o(v)a)())s: my(( test) message'