Refs #15727 -- Captured failed request log in CSPMiddlewareTest.
Some checks are pending
Docs / spelling (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Docs / lint-docs (push) Waiting to run
Linters / flake8 (push) Waiting to run
Linters / isort (push) Waiting to run
Linters / black (push) Waiting to run
Tests / Windows, SQLite, Python 3.13 (push) Waiting to run
Tests / JavaScript tests (push) Waiting to run

This commit is contained in:
Jacob Walls 2025-08-26 17:26:01 -04:00 committed by GitHub
parent 66082a7dac
commit d454aefbd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -100,7 +100,8 @@ class CSPMiddlewareTest(SimpleTestCase):
"""
Test that the CSP headers are not added to the debug view.
"""
response = self.client.get("/csp-500/")
with self.assertLogs("django.request", "WARNING"):
response = self.client.get("/csp-500/")
self.assertNotIn(CSP.HEADER_ENFORCE, response)
self.assertNotIn(CSP.HEADER_REPORT_ONLY, response)