1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #34695 -- Added tests for check for CSRF_FAILURE_VIEW signature with valid class-based view.

This commit is contained in:
Mariusz Felisiak 2023-07-11 10:46:34 +02:00 committed by GitHub
parent 5a2e11fd31
commit c7276a9cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(