def test_text_message_to_json(self): msg = TextMessage('to_addr', 'from_addr', '1348831860', 'this is a test') self.assertEqual( json.loads(msg.to_json()), { 'touser': '******', 'msgtype': 'text', 'text': { 'content': 'this is a test' } })
def test_text_message_to_json(self): msg = TextMessage( 'to_addr', 'from_addr', '1348831860', 'this is a test') self.assertEqual( json.loads(msg.to_json()), { 'touser': '******', 'msgtype': 'text', 'text': { 'content': 'this is a test' } })
def test_text_message_to_xml(self): msg = TextMessage('to_addr', 'from_addr', '1348831860', 'this is a test') self.assertEqual( msg.to_xml(), "".join([ "<xml>", "<ToUserName>to_addr</ToUserName>", "<FromUserName>from_addr</FromUserName>", "<CreateTime>1348831860</CreateTime>", "<MsgType>text</MsgType>", "<Content>this is a test</Content>", "</xml>", ]))
def test_text_message_to_xml(self): msg = TextMessage( 'to_addr', 'from_addr', '1348831860', 'this is a test') self.assertEqual( msg.to_xml(), "".join([ "<xml>", "<ToUserName>to_addr</ToUserName>", "<FromUserName>from_addr</FromUserName>", "<CreateTime>1348831860</CreateTime>", "<MsgType>text</MsgType>", "<Content>this is a test</Content>", "</xml>", ]))