mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #32800 -- Avoided use of _does_token_match() in some CSRF tests.
This commit is contained in:
committed by
Mariusz Felisiak
parent
0820175d81
commit
3f0025c18a
@@ -1,14 +1,15 @@
|
||||
from django.http import HttpRequest
|
||||
from django.middleware.csrf import _does_token_match as equivalent_tokens
|
||||
from django.template.context_processors import csrf
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from .tests import CsrfFunctionTestMixin
|
||||
|
||||
class TestContextProcessor(SimpleTestCase):
|
||||
|
||||
class TestContextProcessor(CsrfFunctionTestMixin, SimpleTestCase):
|
||||
|
||||
def test_force_token_to_string(self):
|
||||
request = HttpRequest()
|
||||
test_token = '1bcdefghij2bcdefghij3bcdefghij4bcdefghij5bcdefghij6bcdefghijABCD'
|
||||
request.META['CSRF_COOKIE'] = test_token
|
||||
token = csrf(request).get('csrf_token')
|
||||
self.assertTrue(equivalent_tokens(str(token), test_token))
|
||||
self.assertMaskedSecretCorrect(token, 'lcccccccX2kcccccccY2jcccccccssIC')
|
||||
|
||||
Reference in New Issue
Block a user