summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-04-09 16:01:37 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-04-12 10:37:28 +0200
commit50a702f3fd87e271945aa5e88ae8a39d7a2149fd (patch)
tree89289ca9a0e4b8c4651be0739ac54c072cc16fde /tests
parentb0f2289426d2af0d3f31e50bd8d5e60a49d62710 (diff)
Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily.
Diffstat (limited to 'tests')
-rw-r--r--tests/logging_tests/tests.py8
-rw-r--r--tests/view_tests/tests/test_defaults.py2
2 files changed, 8 insertions, 2 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)
diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py
index 415a9a8c67..66bc1da168 100644
--- a/tests/view_tests/tests/test_defaults.py
+++ b/tests/view_tests/tests/test_defaults.py
@@ -123,7 +123,7 @@ class DefaultsTests(TestCase):
)
def test_custom_bad_request_template(self):
response = self.client.get("/raises400/")
- self.assertIs(response.wsgi_request, response.context[-1].request)
+ self.assertIs(response.wsgi_request, response.context.request)
@override_settings(
TEMPLATES=[