mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-12-02 05:43:44 +03:00
Python 3 fixes
This commit is contained in:
parent
b4ed9b5f44
commit
54fb1de5d2
|
@ -64,7 +64,7 @@ class BaseAPITestCase(object):
|
||||||
is_json = bool(
|
is_json = bool(
|
||||||
filter(lambda x: 'json' in x, self.response._headers['content-type']))
|
filter(lambda x: 'json' in x, self.response._headers['content-type']))
|
||||||
if is_json and self.response.content:
|
if is_json and self.response.content:
|
||||||
self.response.json = json.loads(self.response.content)
|
self.response.json = json.loads(self.response.content.decode())
|
||||||
else:
|
else:
|
||||||
self.response.json = {}
|
self.response.json = {}
|
||||||
if status_code:
|
if status_code:
|
||||||
|
@ -176,7 +176,7 @@ class APITestCase1(TestCase, BaseAPITestCase):
|
||||||
result['uid'] = int_to_base36(user.pk)
|
result['uid'] = int_to_base36(user.pk)
|
||||||
else:
|
else:
|
||||||
from django.utils.http import urlsafe_base64_encode
|
from django.utils.http import urlsafe_base64_encode
|
||||||
result['uid'] = urlsafe_base64_encode(force_bytes(user.pk))
|
result['uid'] = urlsafe_base64_encode(force_bytes(user.pk)).decode()
|
||||||
result['token'] = default_token_generator.make_token(user)
|
result['token'] = default_token_generator.make_token(user)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user