From 5a7d01ae7137d45ba5430784140c34e6ab656b49 Mon Sep 17 00:00:00 2001 From: Oleg Abramov Date: Wed, 4 Apr 2018 13:44:43 +0300 Subject: [PATCH] Added test sendVideoNote --- tests/test_bot.py | 14 ++++++++++++++ tests/types/dataset.py | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/test_bot.py b/tests/test_bot.py index 9726f995..ef8161ed 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -141,3 +141,17 @@ async def test_send_voice(bot: Bot, event_loop): parse_mode=types.ParseMode.HTML, duration=voice.duration, disable_notification=False) assert result == msg + + +@pytest.mark.asyncio +async def test_send_video_note(bot: Bot, event_loop): + """ sendVideoNote method test """ + from .types.dataset import MESSAGE_WITH_VIDEO_NOTE, VIDEO_NOTE + msg = types.Message(**MESSAGE_WITH_VIDEO_NOTE) + video_note = types.VideoNote(**VIDEO_NOTE) + + async with FakeTelegram(message_dict=MESSAGE_WITH_VIDEO_NOTE, loop=event_loop): + result = await bot.send_video_note(chat_id=msg.chat.id, video_note=video_note.file_id, + duration=video_note.duration, length=video_note.length, + disable_notification=False) + assert result == msg diff --git a/tests/types/dataset.py b/tests/types/dataset.py index 8bc91037..6336a6e4 100644 --- a/tests/types/dataset.py +++ b/tests/types/dataset.py @@ -152,6 +152,14 @@ VIDEO = { "file_size": 10099782 } +VIDEO_NOTE = { + "duration": 4, + "length": 240, + "thumb": PHOTO, + "file_id": "AbCdEfGhIjKlMnOpQrStUvWxYz", + "file_size": 186562 +} + VOICE = { "duration": 1, "mime_type": "audio/ogg", @@ -309,7 +317,13 @@ MESSAGE_WITH_VIDEO = { "caption": "description" } -MESSAGE_WITH_VIDEO_NOTE = {} +MESSAGE_WITH_VIDEO_NOTE = { + "message_id": 55934, + "from": USER, + "chat": CHAT, + "date": 1522835890, + "video_note": VIDEO_NOTE +} MESSAGE_WITH_VOICE = { "message_id": 12345,