Use decode with utf-8 encoding.
This commit is contained in:
parent
447d026a41
commit
27110b65e4
|
@ -49,7 +49,7 @@ def encode_id_token(id_token_dic, client_secret):
|
||||||
|
|
||||||
Return a hash.
|
Return a hash.
|
||||||
"""
|
"""
|
||||||
id_token_hash = jwt.encode(id_token_dic, client_secret)
|
id_token_hash = jwt.encode(id_token_dic, client_secret).decode('utf-8')
|
||||||
|
|
||||||
return id_token_hash
|
return id_token_hash
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ class AuthorizationCodeFlowTestCase(TestCase):
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, value in iter(to_check.items()):
|
for key, value in iter(to_check.items()):
|
||||||
is_input_ok = input_html.format(key, value) in response.content
|
is_input_ok = input_html.format(key, value) in response.content.decode('utf-8')
|
||||||
self.assertEqual(is_input_ok, True,
|
self.assertEqual(is_input_ok, True,
|
||||||
msg='Hidden input for "'+key+'" fails.')
|
msg='Hidden input for "'+key+'" fails.')
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class TokenTestCase(TestCase):
|
||||||
'state': self.state,
|
'state': self.state,
|
||||||
}
|
}
|
||||||
response = self._post_request(post_data)
|
response = self._post_request(post_data)
|
||||||
response_dic = json.loads(response.content)
|
response_dic = json.loads(response.content.decode('utf-8'))
|
||||||
|
|
||||||
self.assertEqual('access_token' in response_dic, True,
|
self.assertEqual('access_token' in response_dic, True,
|
||||||
msg='"access_token" key is missing in response.')
|
msg='"access_token" key is missing in response.')
|
||||||
|
@ -117,7 +117,7 @@ class TokenTestCase(TestCase):
|
||||||
invalid_data['code'] = code.code
|
invalid_data['code'] = code.code
|
||||||
|
|
||||||
response = self._post_request(invalid_data)
|
response = self._post_request(invalid_data)
|
||||||
response_dic = json.loads(response.content)
|
response_dic = json.loads(response.content.decode('utf-8'))
|
||||||
|
|
||||||
self.assertEqual('error' in response_dic, True,
|
self.assertEqual('error' in response_dic, True,
|
||||||
msg='"error" key should exists in response.')
|
msg='"error" key should exists in response.')
|
||||||
|
|
Loading…
Reference in a new issue