Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
def test_wechatreply_render():
    message = werobot.testing.make_text_message('test')
    reply = werobot.reply.WeChatReply(message, content='hello',
                                      time=1359803261)
    try:
        reply.render()
    except NotImplementedError:
        pass
    else:
        raise
Ejemplo n.º 4
0
def test_wechatreply_render():
    message = werobot.testing.make_text_message('test')
    reply = werobot.reply.WeChatReply(message,
                                      content='hello',
                                      time=1359803261)
    try:
        reply.render()
    except NotImplementedError:
        pass
    else:
        raise
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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()