aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_linkifytext.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-08-24 20:49:12 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-08-25 19:42:06 +0200
commit64cf9f64e1097f8b4dacf08c9c6cc6a6baeb77a3 (patch)
tree935792fc4512428bba7e75c4c88c229a70da4be3 /_pytest/test_linkifytext.py
parent6042a85c9b2e9bf266d3225a2a878583ea5b944d (diff)
downloadwee-slack-64cf9f64e1097f8b4dacf08c9c6cc6a6baeb77a3.tar.gz
Add some more tests for linkify_text
Diffstat (limited to '_pytest/test_linkifytext.py')
-rw-r--r--_pytest/test_linkifytext.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/_pytest/test_linkifytext.py b/_pytest/test_linkifytext.py
index fb251b8..a086fde 100644
--- a/_pytest/test_linkifytext.py
+++ b/_pytest/test_linkifytext.py
@@ -49,8 +49,35 @@ def test_linkifytext_at_channel(team):
assert text == '<!channel>: my test message'
+def test_linkifytext_at_group(team):
+ text = linkify_text('@group: my test message', team)
+
+ assert text == '<!group>: my test message'
+
+def test_linkifytext_at_here(team):
+ text = linkify_text('@here: my test message', team)
+
+ assert text == '<!here>: my test message'
+
def test_linkifytext_channel(team, channel_general):
channel_name = re.sub(r'^[#&]', '', channel_general.name)
text = linkify_text('#{}: my test message'.format(channel_name), team)
assert text == '<#{}|{}>: my test message'.format(channel_general.id, channel_name)
+
+def test_linkifytext_not_private_using_hash(team, channel_private):
+ channel_name = re.sub(r'^[#&]', '', channel_private.name)
+ text = linkify_text('#{}: my test message'.format(channel_name), team)
+
+ assert text == '#{}: my test message'.format(channel_name)
+
+def test_linkifytext_not_private_using_ampersand(team, channel_private):
+ channel_name = re.sub(r'^[#&]', '', channel_private.name)
+ text = linkify_text('&{}: my test message'.format(channel_name), team)
+
+ assert text == '&amp;{}: my test message'.format(channel_name)
+
+def test_linkifytext_not_dm(team, channel_dm):
+ text = linkify_text('#{}: my test message'.format(channel_dm.name), team)
+
+ assert text == '#{}: my test message'.format(channel_dm.name)