aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_unfurl.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 22:06:06 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-20 22:58:56 +0100
commit5b40e22b1a6d8cd44f72195d3a15338e72fe2ec7 (patch)
tree2dd8c111a76054eefde2078694fcc11ee2ab0358 /_pytest/test_unfurl.py
parentcc6459415bbf117353564cc709da0343434dcf23 (diff)
downloadwee-slack-5b40e22b1a6d8cd44f72195d3a15338e72fe2ec7.tar.gz
Only use fallback for refs if ref is not found
Fallbacks in messages are not changed when channels/users/groups are renamed, so they shouldn't be used unless the ref can't be found. Links are not refs we look up, so they are still treated the same way.
Diffstat (limited to '_pytest/test_unfurl.py')
-rw-r--r--_pytest/test_unfurl.py34
1 files changed, 27 insertions, 7 deletions
diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py
index 6178bbb..fe1fc3d 100644
--- a/_pytest/test_unfurl.py
+++ b/_pytest/test_unfurl.py
@@ -28,23 +28,38 @@ import pytest
{
'input': "<@U407ABLLW|@othernick>: foo",
'output': "@alice: foo",
- 'ignore_alt_text': True,
+ },
+ {
+ 'input': "<@UNKNOWN|@othernick>: foo",
+ 'output': "@othernick: foo",
},
{
'input': "foo <#C407ABS94|otherchannel> foo",
+ 'output': "foo #general foo",
+ },
+ {
+ 'input': "foo <#UNKNOWN|otherchannel> foo",
'output': "foo #otherchannel foo",
},
{
- 'input': "foo <#C407ABS94> foo",
- 'output': "foo #general foo",
+ 'input': "url: <https://example.com|fallback> suffix",
+ 'output': "url: https://example.com suffix",
+ 'ignore_alt_text': True,
},
{
'input': "url: <https://example.com|example> suffix",
'output': "url: https://example.com (example) suffix",
+ 'auto_link_display': 'both',
},
{
'input': "url: <https://example.com|example with spaces> suffix",
'output': "url: https://example.com (example with spaces) suffix",
+ 'auto_link_display': 'both',
+ },
+ {
+ 'input': "url: <https://example.com|example.com> suffix",
+ 'output': "url: https://example.com (example.com) suffix",
+ 'auto_link_display': 'both',
},
{
'input': "url: <https://example.com|example.com> suffix",
@@ -67,8 +82,9 @@ import pytest
'auto_link_display': 'url',
},
{
- 'input': "<@U407ABLLW|@othernick> multiple unfurl <https://example.com|example with spaces>",
- 'output': "@othernick multiple unfurl https://example.com (example with spaces)",
+ 'input': "<@U407ABLLW> multiple unfurl <https://example.com|example with spaces>",
+ 'output': "@alice multiple unfurl https://example.com (example with spaces)",
+ 'auto_link_display': 'both',
},
{
'input': "try the #general channel",
@@ -79,8 +95,12 @@ import pytest
'output': "@alice I think 3 > 2",
},
{
- 'input': "<!subteam^U407ABLLW|@dev> This is announcement for the dev team",
- 'output': "@dev This is announcement for the dev team"
+ 'input': "<!subteam^TGX0ALBK3|@othersubteam> This is announcement for the dev team",
+ 'output': "@test This is announcement for the dev team"
+ },
+ {
+ 'input': "<!subteam^UNKNOWN|@othersubteam> This is announcement for the dev team",
+ 'output': "@othersubteam This is announcement for the dev team"
}
))
def test_unfurl_refs(case, realish_eventrouter):