diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-08-23 00:09:19 -0700 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-11-29 10:48:31 +0100 |
commit | 3ff7f6cf07a722635d690785c31ac89484134bee (patch) | |
tree | efdddf6b4996c5120573263b336988734eb26c8c /tests/csrf_tests | |
parent | 5d80843ebc5376d00f98bf2a6aadbada4c29365c (diff) | |
download | django-3ff7f6cf07a722635d690785c31ac89484134bee.tar.gz |
Refs #32800 -- Renamed _sanitize_token() to _check_token_format().
Diffstat (limited to 'tests/csrf_tests')
-rw-r--r-- | tests/csrf_tests/tests.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 203ef0f419..71e75854db 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -8,7 +8,7 @@ from django.middleware.csrf import ( CSRF_ALLOWED_CHARS, CSRF_SECRET_LENGTH, CSRF_SESSION_KEY, CSRF_TOKEN_LENGTH, REASON_BAD_ORIGIN, REASON_CSRF_TOKEN_MISSING, REASON_NO_CSRF_COOKIE, CsrfViewMiddleware, InvalidTokenFormat, - RejectRequest, _does_token_match, _mask_cipher_secret, _sanitize_token, + RejectRequest, _check_token_format, _does_token_match, _mask_cipher_secret, _unmask_cipher_token, get_token, rotate_token, ) from django.test import SimpleTestCase, override_settings @@ -106,7 +106,7 @@ class CsrfFunctionTests(CsrfFunctionTestMixin, SimpleTestCase): self.assertNotEqual(cookie, TEST_SECRET) self.assertIs(request.META['CSRF_COOKIE_NEEDS_UPDATE'], True) - def test_sanitize_token_valid(self): + def test_check_token_format_valid(self): cases = [ # A token of length CSRF_SECRET_LENGTH. TEST_SECRET, @@ -116,10 +116,10 @@ class CsrfFunctionTests(CsrfFunctionTestMixin, SimpleTestCase): ] for token in cases: with self.subTest(token=token): - actual = _sanitize_token(token) + actual = _check_token_format(token) self.assertIsNone(actual) - def test_sanitize_token_invalid(self): + def test_check_token_format_invalid(self): cases = [ (64 * '*', 'has invalid characters'), (16 * 'a', 'has incorrect length'), @@ -127,7 +127,7 @@ class CsrfFunctionTests(CsrfFunctionTestMixin, SimpleTestCase): for token, expected_message in cases: with self.subTest(token=token): with self.assertRaisesMessage(InvalidTokenFormat, expected_message): - _sanitize_token(token) + _check_token_format(token) def test_does_token_match(self): cases = [ |