summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-02-22 15:40:04 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2015-02-22 15:46:35 +0100
commit88a5f17d25a25dbd2ebcf905dcecc45ce78a1615 (patch)
tree2721d7feef75dc48cc354cc28aecab50a6b2444f /tests
parenteba6dff581aa8bd6a1c08456e83e68ad09ae4ec3 (diff)
Fixed #24389 -- Isolated the CSRF view from the TEMPLATES setting.
Thanks uranusjr for the report and analysis.
Diffstat (limited to 'tests')
-rw-r--r--tests/view_tests/tests/test_csrf.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py
index 4d82588f88..9baee9ce34 100644
--- a/tests/view_tests/tests/test_csrf.py
+++ b/tests/view_tests/tests/test_csrf.py
@@ -21,7 +21,6 @@ class CsrfViewTests(TestCase):
"""
Test that an invalid request is rejected with a localized error message.
"""
-
response = self.client.post('/')
self.assertContains(response, "Forbidden", status_code=403)
self.assertContains(response,
@@ -63,3 +62,15 @@ class CsrfViewTests(TestCase):
"ensure that your browser is not being hijacked "
"by third parties.",
status_code=403)
+
+ # In Django 2.0, this can be changed to TEMPLATES=[] because the code path
+ # that reads the TEMPLATE_* settings in that case will have been removed.
+ @override_settings(TEMPLATES=[{
+ 'BACKEND': 'django.template.backends.dummy.TemplateStrings',
+ }])
+ def test_no_django_template_engine(self):
+ """
+ The CSRF view doesn't depend on the TEMPLATES configuration (#24388).
+ """
+ response = self.client.post('/')
+ self.assertContains(response, "Forbidden", status_code=403)