aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_linkifytext.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-04-02 20:46:56 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-04-02 20:46:56 +0200
commit32d63857a0f7f00fc462f9069e32f22d803985fe (patch)
tree7edcb8026c74680617b90f7facef929d27577324 /_pytest/test_linkifytext.py
parent55ac43c0254ec6b1fdad6841104594f0645aaea1 (diff)
downloadwee-slack-32d63857a0f7f00fc462f9069e32f22d803985fe.tar.gz
Keep text directly after @channel/group/here when linkifying
Previously, when writing e.g. `@channel: test` the colon would be lost.
Diffstat (limited to '_pytest/test_linkifytext.py')
-rw-r--r--_pytest/test_linkifytext.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/_pytest/test_linkifytext.py b/_pytest/test_linkifytext.py
index c8489be..da672dc 100644
--- a/_pytest/test_linkifytext.py
+++ b/_pytest/test_linkifytext.py
@@ -58,3 +58,19 @@ def test_linkifytext_names_with_apostrophe(realish_eventrouter):
text = linkify_text('@O\'Connor: my test message', team, channel)
assert text == '@O\'Connor: my test message'
+
+def test_linkifytext_at_channel(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('@channel: my test message', team, channel)
+
+ assert text == '<!channel>: my test message'
+
+def test_linkifytext_channel(realish_eventrouter):
+ team = realish_eventrouter.teams.values()[0]
+ channel = team.channels.values()[0]
+
+ text = linkify_text('#{}: my test message'.format(channel.name), team, channel)
+
+ assert text == '<#{}|{}>: my test message'.format(channel.id, channel.name)