def test_convert(): message = werobot.testing.make_text_message('test') reply = werobot.reply.TextReply(message, content='中文', time=1359803261) assert reply.render() reply = werobot.reply.TextReply(message, content=to_unicode('中文'), time=1359803261) assert reply.render()
def test_convert(): message = werobot.test.make_text_message('test') reply = werobot.reply.TextReply(message, content='中文', time=1359803261) assert reply.render() reply = werobot.reply.TextReply(message, content=to_unicode('中文'), time=1359803261) assert reply.render()
def test_text_render(): message = werobot.test.make_text_message('test') reply = werobot.reply.TextReply(message, content='hello', time=1359803261) reply_message = """ <xml> <ToUserName><![CDATA[test]]></ToUserName> <FromUserName><![CDATA[test]]></FromUserName> <CreateTime>1359803261</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[hello]]></Content> <FuncFlag>0</FuncFlag> </xml> """.strip().replace(" ", "").replace("\n", "") result = reply.render().strip().replace(" ", "").replace("\n", "") assert result == to_unicode(reply_message)
def test_to_unicode(): assert to_unicode(5) == '5' if py3k: assert to_unicode(b'b') == 'b' else: assert to_unicode('喵') == unicode('喵'.decode('utf-8'))
def test_convert(): message = werobot.test.make_text_message("test") reply = werobot.reply.TextReply(message, content="中文", time=1359803261) assert reply.render() reply = werobot.reply.TextReply(message, content=to_unicode("中文"), time=1359803261) assert reply.render()