Add sendVenue test

This commit is contained in:
Oleg Abramov 2018-04-04 16:55:14 +03:00
parent e3da438d9f
commit 486978abe4
2 changed files with 34 additions and 5 deletions

View file

@ -186,7 +186,7 @@ async def test_send_location(bot: Bot, event_loop):
@pytest.mark.asyncio
async def test_edit_message_live_location(bot: Bot, event_loop):
""" editMessageLiveLocation method test"""
""" editMessageLiveLocation method test """
from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
msg = types.Message(**MESSAGE_WITH_LOCATION)
location = types.Location(**LOCATION)
@ -206,7 +206,7 @@ async def test_edit_message_live_location(bot: Bot, event_loop):
@pytest.mark.asyncio
async def test_stop_message_live_location(bot: Bot, event_loop):
""" editMessageLiveLocation method test"""
""" stopMessageLiveLocation method test """
from .types.dataset import MESSAGE_WITH_LOCATION
msg = types.Message(**MESSAGE_WITH_LOCATION)
@ -219,3 +219,18 @@ async def test_stop_message_live_location(bot: Bot, event_loop):
async with FakeTelegram(message_dict=True, loop=event_loop):
result = await bot.stop_message_live_location(chat_id=msg.chat.id, message_id=msg.message_id)
assert isinstance(result, bool) and result is True
@pytest.mark.asyncio
async def test_send_venue(bot: Bot, event_loop):
""" sendVenue method test """
from .types.dataset import MESSAGE_WITH_VENUE, VENUE, LOCATION
msg = types.Message(**MESSAGE_WITH_VENUE)
location = types.Location(**LOCATION)
venue = types.Venue(**VENUE)
async with FakeTelegram(message_dict=MESSAGE_WITH_VENUE, loop=event_loop):
result = await bot.send_venue(msg.chat.id, latitude=location.latitude, longitude=location.longitude,
title=venue.title, address=venue.address, foursquare_id=venue.foursquare_id,
disable_notification=False)
assert result == msg

View file

@ -106,8 +106,15 @@ INVOICE = {
}
LOCATION = {
"latitude": 55.693416,
"longitude": 37.624605
"latitude": 50.693416,
"longitude": 30.624605
}
VENUE = {
"location": LOCATION,
"title": "Venue Name",
"address": "Venue Address",
"foursquare_id": "4e6f2cec483bad563d150f98"
}
SHIPPING_ADDRESS = {
@ -315,7 +322,14 @@ MESSAGE_WITH_SUCCESSFUL_PAYMENT = {
MESSAGE_WITH_SUPERGROUP_CHAT_CREATED = {}
MESSAGE_WITH_VENUE = {}
MESSAGE_WITH_VENUE = {
"message_id": 56004,
"from": USER,
"chat": CHAT,
"date": 1522849819,
"location": LOCATION,
"venue": VENUE
}
MESSAGE_WITH_VIDEO = {
"message_id": 12345,