Ejemplo n.º 1
0
async def test_send_video(bot: Bot):
    """ sendVideo method test with file_id """
    from .types.dataset import MESSAGE_WITH_VIDEO, VIDEO
    msg = types.Message(**MESSAGE_WITH_VIDEO)
    video = types.Video(**VIDEO)

    async with FakeTelegram(message_data=MESSAGE_WITH_VIDEO):
        result = await bot.send_video(chat_id=msg.chat.id, video=video.file_id, duration=video.duration,
                                      width=video.width, height=video.height, caption=msg.caption,
                                      parse_mode=types.ParseMode.HTML, supports_streaming=True,
                                      disable_notification=False)
        assert result == msg
Ejemplo n.º 2
0
from aiogram import types
from .dataset import AUDIO, ANIMATION, \
    DOCUMENT, PHOTO, VIDEO

WIDTH = 'width'
HEIGHT = 'height'

input_media_audio = types.InputMediaAudio(types.Audio(**AUDIO))
input_media_animation = types.InputMediaAnimation(types.Animation(**ANIMATION))
input_media_document = types.InputMediaDocument(types.Document(**DOCUMENT))
input_media_video = types.InputMediaVideo(types.Video(**VIDEO))
input_media_photo = types.InputMediaPhoto(types.PhotoSize(**PHOTO))


def test_field_width():
    """
    https://core.telegram.org/bots/api#inputmedia
    """
    assert not hasattr(input_media_audio, WIDTH)
    assert not hasattr(input_media_document, WIDTH)
    assert not hasattr(input_media_photo, WIDTH)

    assert hasattr(input_media_animation, WIDTH)
    assert hasattr(input_media_video, WIDTH)


def test_field_height():
    """
    https://core.telegram.org/bots/api#inputmedia
    """
    assert not hasattr(input_media_audio, HEIGHT)