(self)
| 502 | self.assertEqual(message.key, 'www.qq.com') |
| 503 | |
| 504 | def test_response_text(self): |
| 505 | wechat = WechatBasic() |
| 506 | wechat.parse_data(data=self.test_message) |
| 507 | |
| 508 | response_xml_1 = wechat.response_text('test message') |
| 509 | response_xml_2 = wechat.response_text('测试文本') |
| 510 | response_xml_3 = wechat.response_text(u'测试文本') |
| 511 | response_xml_4 = wechat.response_text('<h1>你好</h1>') |
| 512 | response_xml_5 = wechat.response_text('<h1>你好</h1>', escape=True) |
| 513 | response_1 = xmltodict.parse(response_xml_1) |
| 514 | response_2 = xmltodict.parse(response_xml_2) |
| 515 | response_3 = xmltodict.parse(response_xml_3) |
| 516 | response_4 = xmltodict.parse(response_xml_4) |
| 517 | response_5 = xmltodict.parse(response_xml_5) |
| 518 | |
| 519 | self.assertEqual(response_1['xml']['ToUserName'], 'fromUser') |
| 520 | self.assertEqual(response_1['xml']['FromUserName'], 'toUser') |
| 521 | self.assertEqual(response_1['xml']['MsgType'], 'text') |
| 522 | |
| 523 | self.assertEqual(response_1['xml']['Content'], 'test message') |
| 524 | self.assertEqual(response_2['xml']['Content'], '测试文本') |
| 525 | self.assertEqual(response_3['xml']['Content'], '测试文本') |
| 526 | self.assertEqual(response_4['xml']['Content'], '<h1>你好</h1>') |
| 527 | self.assertEqual(response_5['xml']['Content'], '<h1>你好</h1>') |
| 528 | |
| 529 | def test_response_image(self): |
| 530 | wechat = WechatBasic() |
nothing calls this directly
no test coverage detected