summaryrefslogtreecommitdiff
path: root/tests/check_framework
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-07-11 10:46:34 +0200
committerGitHub <noreply@github.com>2023-07-11 10:46:34 +0200
commitc7276a9cb97e8581faccb6c66a6a490e2d400c07 (patch)
tree733eeb50d61806140f005ac3053d4edfafc3a783 /tests/check_framework
parent5a2e11fd31950336ea996ce5240fd16f4f3c3614 (diff)
Refs #34695 -- Added tests for check for CSRF_FAILURE_VIEW signature with valid class-based view.
Diffstat (limited to 'tests/check_framework')
-rw-r--r--tests/check_framework/test_security.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/check_framework/test_security.py b/tests/check_framework/test_security.py
index 3e20f35f01..b1839f48c3 100644
--- a/tests/check_framework/test_security.py
+++ b/tests/check_framework/test_security.py
@@ -4,6 +4,7 @@ from django.core.checks.security import base, csrf, sessions
from django.core.management.utils import get_random_secret_key
from django.test import SimpleTestCase
from django.test.utils import override_settings
+from django.views.generic import View
class CheckSessionCookieSecureTest(SimpleTestCase):
@@ -609,6 +610,9 @@ def failure_view_with_invalid_signature():
pass
+good_class_based_csrf_failure_view = View.as_view()
+
+
class CSRFFailureViewTest(SimpleTestCase):
@override_settings(CSRF_FAILURE_VIEW="")
def test_failure_view_import_error(self):
@@ -638,6 +642,14 @@ class CSRFFailureViewTest(SimpleTestCase):
[Error(msg, id="security.E101")],
)
+ @override_settings(
+ CSRF_FAILURE_VIEW=(
+ "check_framework.test_security.good_class_based_csrf_failure_view"
+ ),
+ )
+ def test_failure_view_valid_class_based(self):
+ self.assertEqual(csrf.check_csrf_failure_view(None), [])
+
class CheckCrossOriginOpenerPolicyTest(SimpleTestCase):
@override_settings(