diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/view_tests/tests/test_csrf.py | 1 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_defaults.py | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py index ef4a50dd45..af16ffd740 100644 --- a/tests/view_tests/tests/test_csrf.py +++ b/tests/view_tests/tests/test_csrf.py @@ -112,6 +112,7 @@ class CsrfViewTests(SimpleTestCase): """A custom CSRF_FAILURE_TEMPLATE_NAME is used.""" response = self.client.post("/") self.assertContains(response, "Test template for CSRF failure", status_code=403) + self.assertIs(response.wsgi_request, response.context.request) def test_custom_template_does_not_exist(self): """An exception is raised if a nonexistent template is supplied.""" diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index f99066e5bb..415a9a8c67 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -111,6 +111,29 @@ class DefaultsTests(TestCase): ( "django.template.loaders.locmem.Loader", { + "400.html": ( + "This is a test template for a 400 error " + ), + }, + ), + ], + }, + } + ] + ) + def test_custom_bad_request_template(self): + response = self.client.get("/raises400/") + self.assertIs(response.wsgi_request, response.context[-1].request) + + @override_settings( + TEMPLATES=[ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "OPTIONS": { + "loaders": [ + ( + "django.template.loaders.locmem.Loader", + { "404.html": ( "This is a test template for a 404 error " "(path: {{ request_path }}, " |
