From 7af8d2da94101adfb4da1de50ea93bc03c2d7a17 Mon Sep 17 00:00:00 2001 From: Oleg Abramov Date: Wed, 4 Apr 2018 12:52:47 +0300 Subject: [PATCH] Added test sendVoice --- tests/test_bot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_bot.py b/tests/test_bot.py index 7ab61d5f..9726f995 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -127,3 +127,17 @@ async def test_send_video(bot: Bot, event_loop): parse_mode=types.ParseMode.HTML, supports_streaming=True, disable_notification=False) assert result == msg + + +@pytest.mark.asyncio +async def test_send_voice(bot: Bot, event_loop): + """ sendVoice method test """ + from .types.dataset import MESSAGE_WITH_VOICE, VOICE + msg = types.Message(**MESSAGE_WITH_VOICE) + voice = types.Voice(**VOICE) + + async with FakeTelegram(message_dict=MESSAGE_WITH_VOICE, loop=event_loop): + result = await bot.send_voice(chat_id=msg.chat.id, voice=voice.file_id, caption=msg.caption, + parse_mode=types.ParseMode.HTML, duration=voice.duration, + disable_notification=False) + assert result == msg