From c3d825f38cfeb7f18caec11222f13f00bba3d992 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 14 Jan 2024 17:47:54 +0100 Subject: [PATCH] Test - Adding extra test for HTML output in emails ( #2103 ) --- .../tests/smtp/test_notification_smtp.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/changedetectionio/tests/smtp/test_notification_smtp.py b/changedetectionio/tests/smtp/test_notification_smtp.py index b3528d63..92a2fa82 100644 --- a/changedetectionio/tests/smtp/test_notification_smtp.py +++ b/changedetectionio/tests/smtp/test_notification_smtp.py @@ -97,6 +97,17 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv set_original_response() global smtp_test_server notification_url = f'mailto://changedetection@{smtp_test_server}:11025/?to=fff@home.com' + notification_body = f""" + + + My Webpage + + +

Test

+ {default_notification_body} + + +""" ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details @@ -104,7 +115,7 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv url_for("settings_page"), data={"application-notification_urls": notification_url, "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": default_notification_body, + "application-notification_body": notification_body, "application-notification_format": 'Text', "requests-time_between_check-minutes": 180, 'application-fetch_backend': "html_requests"}, @@ -161,5 +172,10 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv assert 'Content-Type: text/html' in msg assert '(removed) So let\'s see what happens.
' in msg # the html part + # https://github.com/dgtlmoon/changedetection.io/issues/2103 + assert '

Test

' in msg + assert '<' not in msg + assert 'Content-Type: text/html' in msg + res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) assert b'Deleted' in res.data