mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Adjusted authentication test for internal CSRF changes.
Private _get_new_csrf_token() was removed in
231de683d8
.
This commit is contained in:
parent
4916854492
commit
19b6091554
|
@ -1,5 +1,6 @@
|
|||
import base64
|
||||
|
||||
import django
|
||||
import pytest
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -218,7 +219,16 @@ class SessionAuthTests(TestCase):
|
|||
Ensure POSTing form over session authentication with CSRF token succeeds.
|
||||
Regression test for #6088
|
||||
"""
|
||||
from django.middleware.csrf import _get_new_csrf_token
|
||||
# Remove this shim when dropping support for Django 2.2.
|
||||
if django.VERSION < (3, 0):
|
||||
from django.middleware.csrf import _get_new_csrf_token
|
||||
else:
|
||||
from django.middleware.csrf import (
|
||||
_get_new_csrf_string, _mask_cipher_secret
|
||||
)
|
||||
|
||||
def _get_new_csrf_token():
|
||||
return _mask_cipher_secret(_get_new_csrf_string())
|
||||
|
||||
self.csrf_client.login(username=self.username, password=self.password)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user