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

Method test_create_qrcode

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

Source from the content-addressed store, hash-verified

965 self.assertEqual(resp['errmsg'], 'ok')
966
967 def test_create_qrcode(self):
968 data = {"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "123"}}}
969
970 # 测试无 appid 和 appsecret 初始化
971 wechat = WechatBasic()
972 with self.assertRaises(NeedParamError):
973 wechat.create_qrcode(data)
974
975 # 测试有 appid 和 appsecret 初始化
976 wechat = WechatBasic(appid=self.appid, appsecret=self.appsecret)
977 with HTTMock(wechat_api_mock):
978 resp = wechat.create_qrcode(data)
979 self.assertEqual(resp['ticket'], 'gQH47joAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL2taZ2Z3TVRtNzJXV1Brb3ZhYmJJAAIEZ23sUwMEmm3sUw==')
980 self.assertEqual(resp['expire_seconds'], 60)
981 self.assertEqual(resp['url'], 'http://weixin.qq.com/q/kZgfwMTm72WWPkovabbI')
982
983 def test_get_template_id(self):
984 # 测试无 appid 和 appsecret 初始化

Callers

nothing calls this directly

Calls 2

create_qrcodeMethod · 0.95
WechatBasicClass · 0.90

Tested by

no test coverage detected