Exemple #1
0
    def test_text_message(self):
        from wechatpy.messages import TextMessage

        msg = TextMessage({
            "Content": "test",
        })

        self.assertEqual("test", msg.content)
Exemple #2
0
    def test_text_message(self):
        from wechatpy.messages import TextMessage

        msg = TextMessage({
            'Content': 'test',
        })

        self.assertEqual('test', msg.content)
    def test_create_reply_with_message(self):
        from wechatpy.messages import TextMessage

        msg = TextMessage({
            'FromUserName': '******',
            'ToUserName': '******',
        })
        reply = create_reply('test', msg, render=False)

        self.assertEqual('user1', reply.target)
        self.assertEqual('user2', reply.source)
Exemple #4
0
    def test_create_reply_with_message(self):
        from wechatpy.messages import TextMessage

        msg = TextMessage({
            "FromUserName": "******",
            "ToUserName": "******",
        })
        reply = create_reply("test", msg, render=False)

        self.assertEqual("user1", reply.target)
        self.assertEqual("user2", reply.source)
        reply.render()
Exemple #5
0
    def test_base_message(self):
        from wechatpy.messages import TextMessage

        timestamp = int(time.time())
        msg = TextMessage({
            "MsgId": 123456,
            "MsgType": "text",
            "FromUserName": "******",
            "ToUserName": "******",
            "CreateTime": timestamp,
        })

        self.assertEqual(123456, msg.id)
        self.assertEqual("user1", msg.source)
        self.assertEqual("user2", msg.target)
        self.assertTrue(isinstance(msg.create_time, datetime))
Exemple #6
0
    def test_base_message(self):
        from wechatpy.messages import TextMessage

        timestamp = int(time.time())
        msg = TextMessage({
            'MsgId': 123456,
            'MsgType': 'text',
            'FromUserName': '******',
            'ToUserName': '******',
            'CreateTime': timestamp,
        })

        self.assertEqual(123456, msg.id)
        self.assertEqual('user1', msg.source)
        self.assertEqual('user2', msg.target)
        self.assertEqual(timestamp, msg.time)