test_jwt_apns_client.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:jwt_apns_client 作者: Mobelux 项目源码 文件源码
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'})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号