Test Message Reply Location

This commit is contained in:
t0rr 2018-08-08 03:22:15 +03:00
parent 3f394c3118
commit da7ca2807f
2 changed files with 34 additions and 0 deletions

View file

@ -405,3 +405,28 @@ class TestMessageReplyMediaGroup:
assert len(result) == len(self.media)
assert result[0] == msg
class TestMessageReplyLocation:
location = types.Location(**dataset.LOCATION)
async def test_reply_location(self, message, bot, monkeypatch, event_loop):
""" Message.reply_location method test """
msg = types.Message(**dataset.MESSAGE_WITH_LOCATION_AND_REPLY)
async with FakeTelegram(message_dict=dataset.MESSAGE_WITH_LOCATION_AND_REPLY,
loop=event_loop, bot=bot, monkeypatch=monkeypatch):
result = await message.reply_location(latitude=self.location.latitude,
longitude=self.location.longitude)
assert result == msg
async def test_reply_location_without_reply(self, message, bot, monkeypatch, event_loop):
""" Message.reply_location method test (without reply_to_message) """
msg = types.Message(**dataset.MESSAGE_WITH_LOCATION)
async with FakeTelegram(message_dict=dataset.MESSAGE_WITH_LOCATION,
loop=event_loop, bot=bot, monkeypatch=monkeypatch):
result = await message.reply_location(latitude=self.location.latitude,
longitude=self.location.longitude, reply=False)
assert result == msg

View file

@ -343,6 +343,15 @@ MESSAGE_WITH_LOCATION = {
"location": LOCATION
}
MESSAGE_WITH_LOCATION_AND_REPLY = {
"message_id": 12345,
"from": USER,
"chat": CHAT,
"date": 1508755473,
"reply_to_message": MESSAGE,
"location": LOCATION
}
MESSAGE_WITH_MIGRATE_TO_CHAT_ID = {
"message_id": 12345,
"from": USER,