def test_make_provider_token_encodes_correctly(self):
"""
Run the token returned by make_provider_token back through jwt.decode() and verify that the expected
payload is there.
"""
issued_at = time.time()
connection = jwt_apns_client.APNSConnection(
team_id='TEAMID',
apns_key_id='KEYID',
apns_key_path=self.KEY_FILE_PATH)
token = connection.make_provider_token(issued_at=issued_at)
options = {
'verify_signature': False,
'verify_exp': False,
'verify_nbf': False,
'verify_iat': False,
'verify_aud': False
}
decoded = jwt.decode(token,
connection.secret,
algorithm=connection.algorithm,
headers=connection.get_token_headers(),
options=options)
self.assertEqual(decoded, {'iat': issued_at, 'iss': 'TEAMID'})
评论列表
文章目录