From 888d418d1993b8a7fe31e66675f3d25e665a5671 Mon Sep 17 00:00:00 2001 From: Mira Weller Date: Tue, 27 Jan 2026 12:47:31 +0100 Subject: [PATCH] Add escaping example to test cases --- src/tests/base/test_mail.py | 5 +++++ src/tests/templates/mailtest.txt | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tests/base/test_mail.py b/src/tests/base/test_mail.py index edd994815f..6fe297de63 100644 --- a/src/tests/base/test_mail.py +++ b/src/tests/base/test_mail.py @@ -202,6 +202,7 @@ def test_placeholder_html_rendering_from_template(env): assert '**Meta**: *Beep*' in djmail.outbox[0].body assert 'Event website: [event & co. kg](https://example.org/dummy)' in djmail.outbox[0].body assert 'Other website: [event & co. kg](https://example.com)' in djmail.outbox[0].body + assert 'Escaping {{curly}} {braces}.' in djmail.outbox[0].body assert '<' not in djmail.outbox[0].body assert '&' not in djmail.outbox[0].body html = _extract_html(djmail.outbox[0]) @@ -218,6 +219,7 @@ def test_placeholder_html_rendering_from_template(env): r'Other website: <strong>event & co. kg</strong>', html ) + assert 'Escaping {{curly}} {braces}.' in html @pytest.mark.django_db @@ -230,6 +232,7 @@ def test_placeholder_html_rendering_from_string(env): "URL with text: Test\n\n" "URL with params: https://example.com/form?action=foo&eventid={event_slug}\n\n" "URL with params and text: [Link & Text](https://example.com/form?action=foo&eventid={event_slug})\n\n" + "Escaping {{{{curly}}}} {{braces}}.\n\n" }) djmail.outbox = [] event, user, organizer = env @@ -253,6 +256,7 @@ def test_placeholder_html_rendering_from_string(env): assert 'URL with text: Test' in djmail.outbox[0].body assert 'URL with params: https://example.com/form?action=foo&eventid=dummy' in djmail.outbox[0].body assert 'URL with params and text: [Link & Text](https://example.com/form?action=foo&eventid=dummy)' in djmail.outbox[0].body + assert 'Escaping {{curly}} {braces}.' in djmail.outbox[0].body assert '<' not in djmail.outbox[0].body assert '&' not in djmail.outbox[0].body html = _extract_html(djmail.outbox[0]) @@ -286,3 +290,4 @@ def test_placeholder_html_rendering_from_string(env): r'style="[^"]+" target="_blank">Link & Text', html ) + assert 'Escaping {{curly}} {braces}.' in html diff --git a/src/tests/templates/mailtest.txt b/src/tests/templates/mailtest.txt index 1bc1487d31..dc1c62ba88 100644 --- a/src/tests/templates/mailtest.txt +++ b/src/tests/templates/mailtest.txt @@ -10,4 +10,5 @@ Payment info: **Meta**: {meta_Test} Event website: [{event}](https://example.org/{event_slug}) -Other website: [{event}]({meta_Website}) \ No newline at end of file +Other website: [{event}]({meta_Website}) +Escaping {{{{curly}}}} {{braces}}.