From fef777b7dced08c4299c8aa2d3a8065371194b21 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Mon, 22 Feb 2021 16:42:27 +0100 Subject: Add tests for link_previous option added in previous commit --- _pytest/test_unwrap_attachments.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to '_pytest/test_unwrap_attachments.py') 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'] -- cgit