aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest
diff options
context:
space:
mode:
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/conftest.py12
-rw-r--r--_pytest/test_linkifytext.py27
2 files changed, 39 insertions, 0 deletions
diff --git a/_pytest/conftest.py b/_pytest/conftest.py
index 87fa834..e997bf6 100644
--- a/_pytest/conftest.py
+++ b/_pytest/conftest.py
@@ -60,6 +60,18 @@ def channel_general(team):
return team.channels[team.get_channel_map()['#general']]
@pytest.fixture
+def channel_private(team):
+ return team.channels[team.get_channel_map()['&some-private-channel']]
+
+@pytest.fixture
+def channel_dm(team):
+ return team.channels[team.get_channel_map()['alice']]
+
+@pytest.fixture
+def channel_mpdm(team):
+ return team.channels[team.get_channel_map()['CharlesTestuser,alice']]
+
+@pytest.fixture
def user_alice(team):
return team.users[team.get_username_map()['alice']]
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)