MCPcopy Create free account
hub / github.com/doraemonext/wechat-python-sdk / test_check_signature

Method test_check_signature

tests/test_basic.py:62–75  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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 初始化

Callers

nothing calls this directly

Calls 2

check_signatureMethod · 0.95
WechatBasicClass · 0.90

Tested by

no test coverage detected