test: Add tests for unfurl_auto_link_display
@@ -30,6 +30,26 @@ slack = wee_slack
'input': "url: <https://example.com|example with spaces> suffix",
'output': "url: https://example.com (example with spaces) suffix",
},
+ {
+ 'input': "url: <https://example.com|example.com> suffix",
+ 'output': "url: example.com suffix",
+ 'auto_link_display': 'text',
+ },
+ {
+ 'input': "url: <https://example.com|different text> suffix",
+ 'output': "url: https://example.com (different text) suffix",
+ 'auto_link_display': 'text',
+ },
+ {
+ 'input': "url: <https://example.com|different text> suffix",
+ 'output': "url: https://example.com (different text) suffix",
+ 'auto_link_display': 'url',
+ },
+ {
+ 'input': "url: <https://example.com|example.com> suffix",
+ 'output': "url: https://example.com suffix",
+ '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)",
@@ -47,5 +67,8 @@ 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))
+ case['input'],
+ ignore_alt_text=case.get('ignore_alt_text', False),
+ auto_link_display=case.get('auto_link_display', 'both'),
+ )
assert result == case['output']
