mirror of https://github.com/django/django.git
Refs #34695 -- Added tests for check for CSRF_FAILURE_VIEW signature with valid class-based view.
This commit is contained in:
parent
5a2e11fd31
commit
c7276a9cb9
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue