mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fixing tests and content types for Telegram Bot API 7.2
This commit is contained in:
parent
27f0631bcf
commit
8aabfe0093
6 changed files with 56 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
from aiogram.enums import StickerFormat
|
||||
from aiogram.methods import AddStickerToSet
|
||||
from aiogram.types import InputSticker
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
|
@ -10,7 +11,7 @@ class TestAddStickerToSet:
|
|||
response: bool = await bot.add_sticker_to_set(
|
||||
user_id=42,
|
||||
name="test stickers pack",
|
||||
sticker=InputSticker(sticker="file id", emoji_list=[":)"]),
|
||||
sticker=InputSticker(sticker="file id", format=StickerFormat.STATIC, emoji_list=[":)"]),
|
||||
)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ class TestCreateNewStickerSet:
|
|||
name="name",
|
||||
title="title",
|
||||
stickers=[
|
||||
InputSticker(sticker="file id", emoji_list=[":)"]),
|
||||
InputSticker(sticker=FSInputFile("file.png"), emoji_list=["=("]),
|
||||
InputSticker(sticker="file id", format=StickerFormat.STATIC, emoji_list=[":)"]),
|
||||
InputSticker(sticker=FSInputFile("file.png"), format=StickerFormat.STATIC, emoji_list=["=("]),
|
||||
],
|
||||
sticker_format=StickerFormat.STATIC,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from aiogram.enums import StickerFormat
|
||||
from aiogram.methods import Request, SetStickerSetThumbnail
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
|
@ -6,6 +7,6 @@ class TestSetStickerSetThumbnail:
|
|||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SetStickerSetThumbnail, ok=True, result=None)
|
||||
|
||||
response: bool = await bot.set_sticker_set_thumbnail(name="test", user_id=42)
|
||||
response: bool = await bot.set_sticker_set_thumbnail(name="test", format=StickerFormat.STATIC, user_id=42)
|
||||
request = bot.get_request()
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ from aiogram.types import (
|
|||
PollOption,
|
||||
ProximityAlertTriggered,
|
||||
ReactionTypeCustomEmoji,
|
||||
SharedUser,
|
||||
Sticker,
|
||||
Story,
|
||||
SuccessfulPayment,
|
||||
|
|
@ -462,6 +463,13 @@ TEST_MESSAGE_USER_SHARED = Message(
|
|||
from_user=User(id=42, is_bot=False, first_name="Test"),
|
||||
user_shared=UserShared(request_id=42, user_id=42),
|
||||
)
|
||||
TEST_MESSAGE_SHARED_USER = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="User"),
|
||||
shared_user=SharedUser(request_id=42, user_id=1),
|
||||
)
|
||||
TEST_MESSAGE_USERS_SHARED = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
|
|
@ -469,7 +477,7 @@ TEST_MESSAGE_USERS_SHARED = Message(
|
|||
from_user=None,
|
||||
users_shared=UsersShared(
|
||||
request_id=0,
|
||||
user_ids=[1, 2],
|
||||
users=[SharedUser(user_id=1), SharedUser(user_id=2)],
|
||||
),
|
||||
)
|
||||
TEST_CHAT_SHARED = Message(
|
||||
|
|
@ -562,6 +570,27 @@ TEST_MESSAGE_BOOST_ADDED = Message(
|
|||
from_user=User(id=42, is_bot=False, first_name="User"),
|
||||
boost_added=ChatBoostAdded(boost_count=1),
|
||||
)
|
||||
TEST_MESSAGE_BUSINESS_CONNECTION_ID = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="User"),
|
||||
business_connection_id="idk"
|
||||
)
|
||||
TEST_MESSAGE_IS_FROM_OFFLINE = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=False, first_name="User"),
|
||||
is_from_offline=True
|
||||
)
|
||||
TEST_MESSAGE_SENDER_BUSINESS_BOT = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, type="private"),
|
||||
from_user=User(id=42, is_bot=True, first_name="Bot"),
|
||||
sender_business_bot=User(id=42, is_bot=True, first_name="Bot")
|
||||
)
|
||||
TEST_MESSAGE_UNKNOWN = Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
|
|
@ -620,6 +649,7 @@ MESSAGES_AND_CONTENT_TYPES = [
|
|||
[TEST_MESSAGE_USER_SHARED, ContentType.USER_SHARED],
|
||||
[TEST_MESSAGE_USERS_SHARED, ContentType.USERS_SHARED],
|
||||
[TEST_CHAT_SHARED, ContentType.CHAT_SHARED],
|
||||
[TEST_MESSAGE_SHARED_USER, ContentType.SHARED_USER],
|
||||
[TEST_MESSAGE_STORY, ContentType.STORY],
|
||||
[TEST_MESSAGE_GIVEAWAY, ContentType.GIVEAWAY],
|
||||
[TEST_MESSAGE_GIVEAWAY_CREATED, ContentType.GIVEAWAY_CREATED],
|
||||
|
|
@ -630,6 +660,9 @@ MESSAGES_AND_CONTENT_TYPES = [
|
|||
[TEST_MESSAGE_GENERAL_FORUM_TOPIC_UNHIDDEN, ContentType.GENERAL_FORUM_TOPIC_UNHIDDEN],
|
||||
[TEST_MESSAGE_WRITE_ACCESS_ALLOWED, ContentType.WRITE_ACCESS_ALLOWED],
|
||||
[TEST_MESSAGE_BOOST_ADDED, ContentType.BOOST_ADDED],
|
||||
[TEST_MESSAGE_BUSINESS_CONNECTION_ID, ContentType.BUSINESS_CONNECTION_ID],
|
||||
[TEST_MESSAGE_IS_FROM_OFFLINE, ContentType.IS_FROM_OFFLINE],
|
||||
[TEST_MESSAGE_SENDER_BUSINESS_BOT, ContentType.SENDER_BUSINESS_BOT],
|
||||
[TEST_MESSAGE_UNKNOWN, ContentType.UNKNOWN],
|
||||
]
|
||||
|
||||
|
|
@ -673,6 +706,7 @@ MESSAGES_AND_COPY_METHODS = [
|
|||
[TEST_MESSAGE_DICE, SendDice],
|
||||
[TEST_MESSAGE_USER_SHARED, None],
|
||||
[TEST_CHAT_SHARED, None],
|
||||
[TEST_MESSAGE_SHARED_USER, None],
|
||||
[TEST_MESSAGE_GIVEAWAY_COMPLETED, None],
|
||||
[TEST_MESSAGE_HAS_MEDIA_SPOILER, None],
|
||||
[TEST_MESSAGE_WEB_APP_DATA, None],
|
||||
|
|
@ -689,6 +723,9 @@ MESSAGES_AND_COPY_METHODS = [
|
|||
[TEST_MESSAGE_GIVEAWAY, None],
|
||||
[TEST_MESSAGE_GIVEAWAY_WINNERS, None],
|
||||
[TEST_MESSAGE_BOOST_ADDED, None],
|
||||
[TEST_MESSAGE_BUSINESS_CONNECTION_ID, None],
|
||||
[TEST_MESSAGE_IS_FROM_OFFLINE, None],
|
||||
[TEST_MESSAGE_SENDER_BUSINESS_BOT, None],
|
||||
[TEST_MESSAGE_UNKNOWN, None],
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue