mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Add sendMediaGroup test
This commit is contained in:
parent
6094fd13a3
commit
b689a084ed
2 changed files with 23 additions and 0 deletions
|
|
@ -155,3 +155,17 @@ async def test_send_video_note(bot: Bot, event_loop):
|
|||
duration=video_note.duration, length=video_note.length,
|
||||
disable_notification=False)
|
||||
assert result == msg
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_media_group(bot: Bot, event_loop):
|
||||
""" sendMediaGroup method test with file_id """
|
||||
from .types.dataset import MESSAGE_WITH_MEDIA_GROUP, PHOTO
|
||||
msg = types.Message(**MESSAGE_WITH_MEDIA_GROUP)
|
||||
photo = types.PhotoSize(**PHOTO)
|
||||
media = [types.InputMediaPhoto(media=photo.file_id), types.InputMediaPhoto(media=photo.file_id)]
|
||||
|
||||
async with FakeTelegram(message_dict=[MESSAGE_WITH_MEDIA_GROUP, MESSAGE_WITH_MEDIA_GROUP], loop=event_loop):
|
||||
result = await bot.send_media_group(msg.chat.id, media=media, disable_notification=False)
|
||||
assert len(result) == len(media)
|
||||
assert result.pop().media_group_id
|
||||
|
|
|
|||
|
|
@ -284,6 +284,15 @@ MESSAGE_WITH_PHOTO = {
|
|||
"caption": "photo description"
|
||||
}
|
||||
|
||||
MESSAGE_WITH_MEDIA_GROUP = {
|
||||
"message_id": 55966,
|
||||
"from": USER,
|
||||
"chat": CHAT,
|
||||
"date": 1522843665,
|
||||
"media_group_id": "12182749320567362",
|
||||
"photo": [PHOTO, PHOTO, PHOTO, PHOTO]
|
||||
}
|
||||
|
||||
MESSAGE_WITH_PINNED_MESSAGE = {}
|
||||
|
||||
MESSAGE_WITH_REPLY_TO_MESSAGE = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue