mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
test_reply_media_group fix
This commit is contained in:
parent
3d6219f441
commit
2678a6afca
2 changed files with 16 additions and 9 deletions
|
|
@ -595,7 +595,7 @@ class Bot(BaseBot):
|
|||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel
|
||||
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
|
||||
:param media: A JSON-serialized array describing photos and videos to be sent
|
||||
:param media: A JSON-serialized array describing photos and videos to be sent. Must include 2–10 items
|
||||
:type media: :obj:`typing.Union[types.MediaGroup, typing.List]`
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound.
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
|
|
|
|||
|
|
@ -379,22 +379,29 @@ class TestMessageVideoNote:
|
|||
|
||||
|
||||
class TestMessageMediaGroup:
|
||||
photo = types.PhotoSize(**dataset.PHOTO)
|
||||
media = [types.InputMediaPhoto(media=photo.file_id), types.InputMediaPhoto(media=photo.file_id)]
|
||||
|
||||
async def test_reply_media_group(self, message, bot, monkeypatch, event_loop):
|
||||
""" Message.reply_media_group method test """
|
||||
msg = types.Message(**dataset.MESSAGE_WITH_MEDIA_GROUP_AND_REPLY)
|
||||
photo = types.InputMediaPhoto
|
||||
async with FakeTelegram(message_dict=dataset.MESSAGE_WITH_MEDIA_GROUP_AND_REPLY,
|
||||
loop=event_loop, bot=bot, monkeypatch=monkeypatch):
|
||||
result = await message.reply_media_group(media=types.MediaGroup())
|
||||
|
||||
assert result == msg
|
||||
async with FakeTelegram(message_dict=[dataset.MESSAGE_WITH_MEDIA_GROUP_AND_REPLY,
|
||||
dataset.MESSAGE_WITH_MEDIA_GROUP_AND_REPLY],
|
||||
loop=event_loop, bot=bot, monkeypatch=monkeypatch):
|
||||
result = await message.reply_media_group(media=self.media)
|
||||
|
||||
assert len(result) == len(self.media)
|
||||
assert result[0] == msg
|
||||
|
||||
async def test_reply_video_note_without_reply(self, message, bot, monkeypatch, event_loop):
|
||||
""" Message.reply_media_group method test (without reply_to_message) """
|
||||
msg = types.Message(**dataset.MESSAGE_WITH_MEDIA_GROUP)
|
||||
|
||||
async with FakeTelegram(message_dict=dataset.MESSAGE_WITH_MEDIA_GROUP,
|
||||
async with FakeTelegram(message_dict=[dataset.MESSAGE_WITH_MEDIA_GROUP,
|
||||
dataset.MESSAGE_WITH_MEDIA_GROUP],
|
||||
loop=event_loop, bot=bot, monkeypatch=monkeypatch):
|
||||
result = await message.reply_media_group(media=types.MediaGroup(), reply=False)
|
||||
result = await message.reply_media_group(media=self.media, reply=False)
|
||||
|
||||
assert result == msg
|
||||
assert len(result) == len(self.media)
|
||||
assert result[0] == msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue