diff options
| author | Adam Johnson <me@adamj.eu> | 2024-04-09 16:01:37 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-04-12 10:37:28 +0200 |
| commit | 50a702f3fd87e271945aa5e88ae8a39d7a2149fd (patch) | |
| tree | 89289ca9a0e4b8c4651be0739ac54c072cc16fde /tests/logging_tests | |
| parent | b0f2289426d2af0d3f31e50bd8d5e60a49d62710 (diff) | |
Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily.
Diffstat (limited to 'tests/logging_tests')
| -rw-r--r-- | tests/logging_tests/tests.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index 747c929cde..610bdc1124 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -1,6 +1,7 @@ import logging from contextlib import contextmanager from io import StringIO +from unittest import mock from admin_scripts.tests import AdminScriptTestCase @@ -482,7 +483,12 @@ class AdminEmailHandlerTest(SimpleTestCase): None, None, ) - handler.emit(record) + with mock.patch.object( + handler, + "format_subject", + side_effect=AssertionError("Should not be called"), + ): + handler.emit(record) self.assertEqual(len(mail.outbox), 0) |
