Test - Adding extra test for HTML output in emails ( #2103 )

pull/2110/head
dgtlmoon 12 months ago committed by GitHub
parent fc3c4b804d
commit c3d825f38c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"""<!DOCTYPE html>
<html lang="en">
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Test</h1>
{default_notification_body}
</body>
</html>
"""
#####################
# 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.<br>' in msg # the html part
# https://github.com/dgtlmoon/changedetection.io/issues/2103
assert '<h1>Test</h1>' in msg
assert '&lt;' 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

Loading…
Cancel
Save