Fix in tests when using JWS.verify_compact. Need allow_none set to True.
This commit is contained in:
parent
146752b7d9
commit
121f7f22cb
2 changed files with 6 additions and 6 deletions
|
@ -122,7 +122,7 @@ class TokenTestCase(TestCase):
|
||||||
response = self._post_request(post_data)
|
response = self._post_request(post_data)
|
||||||
response_dic = json.loads(response.content.decode('utf-8'))
|
response_dic = json.loads(response.content.decode('utf-8'))
|
||||||
|
|
||||||
id_token = JWS().verify_compact(response_dic['id_token'].encode('utf-8'), SIGKEYS)
|
id_token = JWS().verify_compact(response_dic['id_token'].encode('utf-8'), SIGKEYS, allow_none=True)
|
||||||
|
|
||||||
token = Token.objects.get(user=self.user)
|
token = Token.objects.get(user=self.user)
|
||||||
self.assertEqual(response_dic['access_token'], token.access_token)
|
self.assertEqual(response_dic['access_token'], token.access_token)
|
||||||
|
@ -149,7 +149,7 @@ class TokenTestCase(TestCase):
|
||||||
response = self._post_request(post_data)
|
response = self._post_request(post_data)
|
||||||
|
|
||||||
response_dic1 = json.loads(response.content.decode('utf-8'))
|
response_dic1 = json.loads(response.content.decode('utf-8'))
|
||||||
id_token1 = JWS().verify_compact(response_dic1['id_token'].encode('utf-8'), SIGKEYS)
|
id_token1 = JWS().verify_compact(response_dic1['id_token'].encode('utf-8'), SIGKEYS, allow_none=True)
|
||||||
|
|
||||||
# Use refresh token to obtain new token
|
# Use refresh token to obtain new token
|
||||||
post_data = self._refresh_token_post_data(response_dic1['refresh_token'])
|
post_data = self._refresh_token_post_data(response_dic1['refresh_token'])
|
||||||
|
@ -158,7 +158,7 @@ class TokenTestCase(TestCase):
|
||||||
response = self._post_request(post_data)
|
response = self._post_request(post_data)
|
||||||
|
|
||||||
response_dic2 = json.loads(response.content.decode('utf-8'))
|
response_dic2 = json.loads(response.content.decode('utf-8'))
|
||||||
id_token2 = JWS().verify_compact(response_dic2['id_token'].encode('utf-8'), SIGKEYS)
|
id_token2 = JWS().verify_compact(response_dic2['id_token'].encode('utf-8'), SIGKEYS, allow_none=True)
|
||||||
|
|
||||||
self.assertNotEqual(response_dic1['id_token'], response_dic2['id_token'])
|
self.assertNotEqual(response_dic1['id_token'], response_dic2['id_token'])
|
||||||
self.assertNotEqual(response_dic1['access_token'], response_dic2['access_token'])
|
self.assertNotEqual(response_dic1['access_token'], response_dic2['access_token'])
|
||||||
|
@ -321,4 +321,4 @@ class TokenTestCase(TestCase):
|
||||||
response = self._post_request(post_data)
|
response = self._post_request(post_data)
|
||||||
response_dic = json.loads(response.content.decode('utf-8'))
|
response_dic = json.loads(response.content.decode('utf-8'))
|
||||||
|
|
||||||
id_token = JWS().verify_compact(response_dic['id_token'].encode('utf-8'), RSAKEYS)
|
id_token = JWS().verify_compact(response_dic['id_token'].encode('utf-8'), RSAKEYS, allow_none=True)
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -37,11 +37,11 @@ setup(
|
||||||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
||||||
],
|
],
|
||||||
tests_require=[
|
tests_require=[
|
||||||
'pyjwkest>=1.0.6,<1.1',
|
'pyjwkest==1.0.8',
|
||||||
'mock==1.3.0',
|
'mock==1.3.0',
|
||||||
],
|
],
|
||||||
|
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'pyjwkest>=1.0.6,<1.1',
|
'pyjwkest==1.0.8',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue