File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
import base64
2
2
3
+ import django
3
4
import pytest
4
5
from django .conf import settings
5
6
from django .contrib .auth .models import User
@@ -218,7 +219,16 @@ def test_post_form_session_auth_passing_csrf(self):
218
219
Ensure POSTing form over session authentication with CSRF token succeeds.
219
220
Regression test for #6088
220
221
"""
221
- from django .middleware .csrf import _get_new_csrf_token
222
+ # Remove this shim when dropping support for Django 2.2.
223
+ if django .VERSION < (3 , 0 ):
224
+ from django .middleware .csrf import _get_new_csrf_token
225
+ else :
226
+ from django .middleware .csrf import (
227
+ _get_new_csrf_string , _mask_cipher_secret
228
+ )
229
+
230
+ def _get_new_csrf_token ():
231
+ return _mask_cipher_secret (_get_new_csrf_string ())
222
232
223
233
self .csrf_client .login (username = self .username , password = self .password )
224
234
You can’t perform that action at this time.
0 commit comments