Пример #1
0
async def test_send_location(bot: Bot):
    """ sendLocation method test """
    from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
    msg = types.Message(**MESSAGE_WITH_LOCATION)
    location = types.Location(**LOCATION)

    async with FakeTelegram(message_data=MESSAGE_WITH_LOCATION):
        result = await bot.send_location(msg.chat.id, latitude=location.latitude, longitude=location.longitude,
                                         live_period=10, disable_notification=False)
        assert result == msg
Пример #2
0
async def test_edit_message_live_location_by_user(bot: Bot):
    """ editMessageLiveLocation method test """
    from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
    msg = types.Message(**MESSAGE_WITH_LOCATION)
    location = types.Location(**LOCATION)

    # editing user's message
    async with FakeTelegram(message_data=True):
        result = await bot.edit_message_live_location(chat_id=msg.chat.id, message_id=msg.message_id,
                                                      latitude=location.latitude, longitude=location.longitude)
        assert isinstance(result, bool) and result is True
Пример #3
0
async def test_edit_message_live_location_by_bot(bot: Bot, event_loop):
    """ editMessageLiveLocation method test """
    from .types.dataset import MESSAGE_WITH_LOCATION, LOCATION
    msg = types.Message(**MESSAGE_WITH_LOCATION)
    location = types.Location(**LOCATION)

    # editing bot message
    async with FakeTelegram(message_data=MESSAGE_WITH_LOCATION, loop=event_loop):
        result = await bot.edit_message_live_location(chat_id=msg.chat.id, message_id=msg.message_id,
                                                      latitude=location.latitude, longitude=location.longitude)
        assert result == msg
Пример #4
0
async def test_send_venue(bot: Bot):
    """ 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_data=MESSAGE_WITH_VENUE):
        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