Added support of Bot API 6.2 (#975)

* Added support of Bot API 6.2
* Added changelog
* Update tests
* Update API version
* Update dependencies, pre-commit config
* Added pytest config
This commit is contained in:
Alex Root Junior 2022-08-14 16:32:29 +03:00 committed by GitHub
parent 4315ecf1a2
commit c1341ba2df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 523 additions and 785 deletions

View file

@ -0,0 +1,63 @@
from typing import List
import pytest
from aiogram.methods import GetCustomEmojiStickers, Request
from aiogram.types import Sticker
from tests.mocked_bot import MockedBot
class TestGetCustomEmojiStickers:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
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=["1"],
)
request: Request = bot.get_request()
assert request.method == "getCustomEmojiStickers"
# assert request.data == {}
assert response == prepare_result.result
@pytest.mark.asyncio
async def test_bot_method(self, bot: MockedBot):
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=["1", "2"],
)
request: Request = bot.get_request()
assert request.method == "getCustomEmojiStickers"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -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",
),
)

View file

@ -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"),
),