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

Method test_response_music

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

Source from the content-addressed store, hash-verified

569 self.assertEqual(resp['xml']['Video']['Description'], '测试描述')
570
571 def test_response_music(self):
572 wechat = WechatBasic()
573 wechat.parse_data(data=self.test_message)
574
575 resp_xml = wechat.response_music(
576 music_url='http://mp3.baidu.com',
577 title='测试音乐',
578 description='测试描述',
579 hq_music_url='http://baidu.com/',
580 )
581 resp = xmltodict.parse(resp_xml)
582
583 self.assertEqual(resp['xml']['ToUserName'], 'fromUser')
584 self.assertEqual(resp['xml']['FromUserName'], 'toUser')
585 self.assertEqual(resp['xml']['MsgType'], 'music')
586 self.assertEqual(resp['xml']['Music']['Title'], '测试音乐')
587 self.assertEqual(resp['xml']['Music']['Description'], '测试描述')
588 self.assertEqual(resp['xml']['Music']['MusicUrl'], 'http://mp3.baidu.com')
589 self.assertEqual(resp['xml']['Music']['HQMusicUrl'], 'http://baidu.com/')
590
591 def test_response_news(self):
592 wechat = WechatBasic()

Callers

nothing calls this directly

Calls 3

parse_dataMethod · 0.95
response_musicMethod · 0.95
WechatBasicClass · 0.90

Tested by

no test coverage detected