diff options
| author | Jan Schär <jscissr@gmail.com> | 2021-09-07 22:50:29 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-10 06:44:39 +0200 |
| commit | 06e59d97a3c6e8e600ff11dadf994fae467fc785 (patch) | |
| tree | 8cf20b034be22fcceefb2bff8505f2e0ccc648b1 /tests/logging_tests | |
| parent | 0a28b42b1510b8093a90718bafd7627ed67fa13b (diff) | |
Fixed #33096 -- Fixed <form> nesting in technical 500 template.
This also prevents sending <form> tags in emails.
Diffstat (limited to 'tests/logging_tests')
| -rw-r--r-- | tests/logging_tests/tests.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index a06cda9efa..666105baff 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -422,6 +422,22 @@ class AdminEmailHandlerTest(SimpleTestCase): msg = mail.outbox[0] self.assertEqual(msg.body, 'message\n\ncustom traceback text') + @override_settings(ADMINS=[('admin', 'admin@example.com')]) + def test_emit_no_form_tag(self): + """HTML email doesn't contain forms.""" + handler = AdminEmailHandler(include_html=True) + record = self.logger.makeRecord( + 'name', logging.ERROR, 'function', 'lno', 'message', None, None, + ) + handler.emit(record) + self.assertEqual(len(mail.outbox), 1) + msg = mail.outbox[0] + self.assertEqual(msg.subject, '[Django] ERROR: message') + self.assertEqual(len(msg.alternatives), 1) + body_html = str(msg.alternatives[0][0]) + self.assertIn('<div id="traceback">', body_html) + self.assertNotIn('<form', body_html) + class SettingsConfigTest(AdminScriptTestCase): """ |
