test_gamecenter.py 文件源码

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

项目:drift 作者: dgnorth 项目源码 文件源码
def test_signature(self):
        # Check signature of token by corrupting the signature
        with self.assertRaises(Unauthorized) as context:
            t = template.copy()
            t['signature'] = t['signature'][:84] + '5' + t['signature'][85:]  # Just modify one random letter.
            validate_gamecenter_token(t)
        self.assertIn("Can't verify signature:", context.exception.description)
        self.assertIn("'padding check failed'", context.exception.description)

        # Check signature of token by modifying the payload
        with self.assertRaises(Unauthorized) as context:
            t = template.copy()
            t['player_id'] = 'G:5637867917'
            validate_gamecenter_token(t)
        self.assertIn("Can't verify signature:", context.exception.description)
        self.assertIn("'bad signature'", context.exception.description)

    # For requests library mock
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号