aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-17 22:14:35 +0200
committerGitHub <noreply@github.com>2017-09-17 22:14:35 +0200
commita4c4dd77c8568d4139fdace7866af2ac2a590f59 (patch)
treeef8da53a4aa73e183fdd4c2335d7890b040ca602 /_pytest
parent5608e22cdeb9ba3a07e2925fc97bb47bcbbc17da (diff)
parent5395df24a05fbb7590249f8cbd5c77eee584889f (diff)
downloadwee-slack-a4c4dd77c8568d4139fdace7866af2ac2a590f59.tar.gz
Merge pull request #401 from ToxicFrog/toxicfrog/unfurl
Fix overzealous regex in unfurl_refs
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/test_unfurl.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py
index b631888..eebe446 100644
--- a/_pytest/test_unfurl.py
+++ b/_pytest/test_unfurl.py
@@ -10,17 +10,17 @@ slack = wee_slack
'output': "foo",
},
{
- 'input': "<@U2147483697|@othernick>: foo",
- 'output': "@testuser: foo",
+ 'input': "<@U407ABLLW|@othernick>: foo",
+ 'output': "@alice: foo",
'ignore_alt_text': True,
},
{
- 'input': "foo <#C2147483705|#otherchannel> foo",
+ 'input': "foo <#C407ABS94|otherchannel> foo",
'output': "foo #otherchannel foo",
},
{
- 'input': "foo <#C2147483705> foo",
- 'output': "foo #test-chan foo",
+ 'input': "foo <#C407ABS94> foo",
+ 'output': "foo #general foo",
},
{
'input': "url: <https://example.com|example> suffix",
@@ -31,23 +31,21 @@ slack = wee_slack
'output': "url: https://example.com (example with spaces) suffix",
},
{
- 'input': "<@U2147483697|@othernick> multiple unfurl <https://example.com|example with spaces>",
+ 'input': "<@U407ABLLW|@othernick> multiple unfurl <https://example.com|example with spaces>",
'output': "@othernick multiple unfurl https://example.com (example with spaces)",
},
{
- 'input': "try the #test-chan channel",
- 'output': "try the #test-chan channel",
+ 'input': "try the #general channel",
+ 'output': "try the #general channel",
+ },
+ {
+ 'input': "<@U407ABLLW> I think 3 > 2",
+ 'output': "@alice I think 3 > 2",
},
))
-def test_unfurl_refs(case):
- pass
- #print myslack
- #slack.servers = myslack.server
- #slack.channels = myslack.channel
- #slack.users = myslack.user
- #slack.message_cache = {}
- #slack.servers[0].users = myslack.user
- #print myslack.channel[0].identifier
-
- #assert slack.unfurl_refs(case['input'], ignore_alt_text=case.get('ignore_alt_text', False)) == case['output']
+def test_unfurl_refs(case, realish_eventrouter):
+ slack.EVENTROUTER = realish_eventrouter
+ result = slack.unfurl_refs(
+ case['input'], ignore_alt_text=case.get('ignore_alt_text', False))
+ assert result == case['output']