def test_text_message(self): from wechatpy.messages import TextMessage msg = TextMessage({ "Content": "test", }) self.assertEqual("test", msg.content)
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)
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()
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))
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)