aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2021-02-22 16:42:27 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2021-02-22 16:42:27 +0100
commitfef777b7dced08c4299c8aa2d3a8065371194b21 (patch)
tree6ffc88df015ef36e150656a3a5dd6b4910d8fa8e
parente461e0441c3bfef9001bb648db400e195e9fa980 (diff)
downloadwee-slack-fef777b7dced08c4299c8aa2d3a8065371194b21.tar.gz
Add tests for link_previous option added in previous commit
-rw-r--r--_pytest/test_unwrap_attachments.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/_pytest/test_unwrap_attachments.py b/_pytest/test_unwrap_attachments.py
index 054c0af..aed696c 100644
--- a/_pytest/test_unwrap_attachments.py
+++ b/_pytest/test_unwrap_attachments.py
@@ -287,8 +287,39 @@ import pytest
"<[color 16711680]>|<[color reset]> Title",
]),
},
+ {
+ 'input_message': {'attachments': [{
+ 'text': 'Attachment text',
+ 'original_url': 'http://from.url',
+ }]},
+ 'input_text_before': "",
+ 'output': "\n".join([
+ "| Attachment text",
+ ]),
+ 'link_previews': True
+ },
+ {
+ 'input_message': {'attachments': [{
+ 'text': 'Attachment text',
+ 'original_url': 'http://from.url',
+ }]},
+ 'input_text_before': "",
+ 'output': '',
+ 'link_previews': False
+ },
+ {
+ 'input_message': {'attachments': [{
+ 'text': 'Attachment text',
+ }]},
+ 'input_text_before': "",
+ 'output': "\n".join([
+ "| Attachment text",
+ ]),
+ 'link_previews': False
+ },
))
def test_unwrap_attachments(case):
+ wee_slack.config.link_previews = case.get('link_previews')
result = wee_slack.unwrap_attachments(
case['input_message'], case['input_text_before'])
assert result == case['output']