summaryrefslogtreecommitdiff
path: root/tests/logging_tests
diff options
context:
space:
mode:
authorNatalia <124304+nessita@users.noreply.github.com>2025-06-05 10:07:17 -0300
committernessita <124304+nessita@users.noreply.github.com>2025-06-06 09:05:32 -0300
commitff835f439cb1ecd8d74a24de12e3c03e5477dc9d (patch)
tree4e0f159484ee9ebaa585a76445ad4bf1ceeaf63d /tests/logging_tests
parent9d72e7daf7299ef1ece56fd657a02f77a469efe9 (diff)
Refs CVE-2025-48432 -- Made SuspiciousOperation logging use log_response() for consistency.
Diffstat (limited to 'tests/logging_tests')
-rw-r--r--tests/logging_tests/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py
index ba65624559..a4de7424f8 100644
--- a/tests/logging_tests/tests.py
+++ b/tests/logging_tests/tests.py
@@ -618,6 +618,15 @@ class SecurityLoggerTest(LoggingAssertionMixin, SimpleTestCase):
self.assertEqual(len(mail.outbox), 1)
self.assertIn("SuspiciousOperation at /suspicious/", mail.outbox[0].body)
+ def test_response_logged(self):
+ with self.assertLogs("django.security.SuspiciousOperation", "ERROR") as handler:
+ response = self.client.get("/suspicious/")
+
+ self.assertLogRecord(
+ handler, "dubious", logging.ERROR, 400, request=response.wsgi_request
+ )
+ self.assertEqual(response.status_code, 400)
+
class SettingsCustomLoggingTest(AdminScriptTestCase):
"""