mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Update tests. Added missing files.
This commit is contained in:
parent
4e0af00b73
commit
f5de712fcc
6 changed files with 115 additions and 8 deletions
|
|
@ -7,14 +7,28 @@ from aiogram.types import Sticker
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetCustomEmojiStickers:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetCustomEmojiStickers, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetCustomEmojiStickers,
|
||||
ok=True,
|
||||
result=[
|
||||
Sticker(
|
||||
file_id="file id",
|
||||
width=42,
|
||||
height=42,
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
custom_emoji_id="1",
|
||||
type="custom_emoji",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[Sticker] = await GetCustomEmojiStickers(
|
||||
custom_emoji_ids=...,
|
||||
custom_emoji_ids=["1"],
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getCustomEmojiStickers"
|
||||
|
|
@ -23,10 +37,25 @@ class TestGetCustomEmojiStickers:
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetCustomEmojiStickers, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetCustomEmojiStickers,
|
||||
ok=True,
|
||||
result=[
|
||||
Sticker(
|
||||
file_id="file id",
|
||||
width=42,
|
||||
height=42,
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
custom_emoji_id="1",
|
||||
type="custom_emoji",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[Sticker] = await bot.get_custom_emoji_stickers(
|
||||
custom_emoji_ids=...,
|
||||
custom_emoji_ids=["1", "2"],
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getCustomEmojiStickers"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class TestGetStickerSet:
|
|||
title="test",
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
contains_masks=False,
|
||||
stickers=[
|
||||
Sticker(
|
||||
file_id="file if",
|
||||
|
|
@ -26,8 +25,10 @@ class TestGetStickerSet:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
)
|
||||
],
|
||||
sticker_type="regular",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -45,7 +46,6 @@ class TestGetStickerSet:
|
|||
title="test",
|
||||
is_animated=False,
|
||||
is_video=False,
|
||||
contains_masks=False,
|
||||
stickers=[
|
||||
Sticker(
|
||||
file_id="file if",
|
||||
|
|
@ -54,8 +54,10 @@ class TestGetStickerSet:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
)
|
||||
],
|
||||
sticker_type="regular",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class TestSendSticker:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
|
|
@ -48,6 +49,7 @@ class TestSendSticker:
|
|||
is_animated=False,
|
||||
is_video=False,
|
||||
file_unique_id="file id",
|
||||
type="regular",
|
||||
),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -50,7 +50,12 @@ class TestTextDecoration:
|
|||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="spoiler", offset=0, length=5),
|
||||
'<span class="tg-spoiler">test</span>',
|
||||
"<tg-spoiler>test</tg-spoiler>",
|
||||
],
|
||||
[
|
||||
html_decoration,
|
||||
MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),
|
||||
'<tg-emoji emoji-id="42">test</tg-emoji>',
|
||||
],
|
||||
[
|
||||
html_decoration,
|
||||
|
|
@ -82,6 +87,11 @@ class TestTextDecoration:
|
|||
[markdown_decoration, MessageEntity(type="email", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="phone_number", offset=0, length=5), "test"],
|
||||
[markdown_decoration, MessageEntity(type="spoiler", offset=0, length=5), "|test|"],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(type="custom_emoji", offset=0, length=5, custom_emoji_id="42"),
|
||||
"[test](tg://emoji?id=42)",
|
||||
],
|
||||
[
|
||||
markdown_decoration,
|
||||
MessageEntity(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue