Use decode with utf-8 encoding.

This commit is contained in:
juanifioren 2015-07-01 17:20:16 -03:00
parent 447d026a41
commit 27110b65e4
3 changed files with 4 additions and 4 deletions

View file

@ -49,7 +49,7 @@ def encode_id_token(id_token_dic, client_secret):
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

View file

@ -147,7 +147,7 @@ class AuthorizationCodeFlowTestCase(TestCase):
}
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,
msg='Hidden input for "'+key+'" fails.')

View file

@ -101,7 +101,7 @@ class TokenTestCase(TestCase):
'state': self.state,
}
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,
msg='"access_token" key is missing in response.')
@ -117,7 +117,7 @@ class TokenTestCase(TestCase):
invalid_data['code'] = code.code
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,
msg='"error" key should exists in response.')