(self)
| 60 | </xml>""" |
| 61 | |
| 62 | def test_check_signature(self): |
| 63 | signature = '41f929117dd6231a953f632cfb3be174b8e3ef08' |
| 64 | timestamp = '1434295379' |
| 65 | nonce = 'ueivlkyhvdng46da0qxr52qzcjabjmo7' |
| 66 | |
| 67 | # 测试无 Token 初始化 |
| 68 | wechat = WechatBasic() |
| 69 | with self.assertRaises(NeedParamError): |
| 70 | wechat.check_signature(signature=signature, timestamp=timestamp, nonce=nonce) |
| 71 | |
| 72 | # 测试有 Token 初始化 |
| 73 | wechat = WechatBasic(token=self.token) |
| 74 | self.assertTrue(wechat.check_signature(signature=signature, timestamp=timestamp, nonce=nonce)) |
| 75 | self.assertFalse(wechat.check_signature(signature=signature, timestamp=timestamp+'2', nonce=nonce)) |
| 76 | |
| 77 | def test_grant_token(self): |
| 78 | # 测试无 appid 和 appsecret 初始化 |
nothing calls this directly
no test coverage detected