Bot API 6.3 (#1063)

* Added API changes

* Added changelog

* Oops. Move changelog

* Update tests

* Remove experimental

* Added message content type

* Update message aliases

* Update changes

* Update texts

* Bump version

* Remove versionadded badge
This commit is contained in:
Alex Root Junior 2022-11-06 14:28:21 +02:00 committed by GitHub
parent 3ae5d904c9
commit b287551590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
275 changed files with 5821 additions and 1133 deletions

View file

@ -0,0 +1,32 @@
import pytest
from aiogram.methods import CloseForumTopic, Request
from tests.mocked_bot import MockedBot
class TestCloseForumTopic:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(CloseForumTopic, ok=True, result=True)
response: bool = await CloseForumTopic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "closeForumTopic"
# 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(CloseForumTopic, ok=True, result=True)
response: bool = await bot.close_forum_topic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "closeForumTopic"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,41 @@
import pytest
from aiogram.methods import CreateForumTopic, Request
from aiogram.types import ForumTopic
from tests.mocked_bot import MockedBot
class TestCreateForumTopic:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
CreateForumTopic,
ok=True,
result=ForumTopic(message_thread_id=42, name="test", icon_color=0xFFD67E),
)
response: ForumTopic = await CreateForumTopic(
chat_id=42,
name="test",
)
request: Request = bot.get_request()
assert request.method == "createForumTopic"
# 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(
CreateForumTopic,
ok=True,
result=ForumTopic(message_thread_id=42, name="test", icon_color=0xFFD67E),
)
response: ForumTopic = await bot.create_forum_topic(
chat_id=42,
name="test",
)
request: Request = bot.get_request()
assert request.method == "createForumTopic"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,32 @@
import pytest
from aiogram.methods import DeleteForumTopic, Request
from tests.mocked_bot import MockedBot
class TestDeleteForumTopic:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(DeleteForumTopic, ok=True, result=True)
response: bool = await DeleteForumTopic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "deleteForumTopic"
# 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(DeleteForumTopic, ok=True, result=True)
response: bool = await bot.delete_forum_topic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "deleteForumTopic"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,37 @@
import pytest
from aiogram.methods import EditForumTopic, Request
from tests.mocked_bot import MockedBot
class TestEditForumTopic:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditForumTopic, ok=True, result=True)
response: bool = await EditForumTopic(
chat_id=42,
message_thread_id=42,
name="test",
icon_color=0xFFD67E,
icon_custom_emoji_id="0",
)
request: Request = bot.get_request()
assert request.method == "editForumTopic"
# 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(EditForumTopic, ok=True, result=True)
response: bool = await bot.edit_forum_topic(
chat_id=42,
message_thread_id=42,
name="test",
icon_custom_emoji_id="0",
)
request: Request = bot.get_request()
assert request.method == "editForumTopic"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,29 @@
from typing import List
import pytest
from aiogram.methods import GetForumTopicIconStickers, Request
from aiogram.types import Sticker
from tests.mocked_bot import MockedBot
class TestGetForumTopicIconStickers:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetForumTopicIconStickers, ok=True, result=[])
response: List[Sticker] = await GetForumTopicIconStickers()
request: Request = bot.get_request()
assert request.method == "getForumTopicIconStickers"
# 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(GetForumTopicIconStickers, ok=True, result=[])
response: List[Sticker] = await bot.get_forum_topic_icon_stickers()
request: Request = bot.get_request()
assert request.method == "getForumTopicIconStickers"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,32 @@
import pytest
from aiogram.methods import ReopenForumTopic, Request
from tests.mocked_bot import MockedBot
class TestReopenForumTopic:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(ReopenForumTopic, ok=True, result=None)
response: bool = await ReopenForumTopic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "reopenForumTopic"
# 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(ReopenForumTopic, ok=True, result=None)
response: bool = await bot.reopen_forum_topic(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "reopenForumTopic"
# assert request.data == {}
assert response == prepare_result.result

View file

@ -0,0 +1,32 @@
import pytest
from aiogram.methods import Request, UnpinAllForumTopicMessages
from tests.mocked_bot import MockedBot
class TestUnpinAllForumTopicMessages:
@pytest.mark.asyncio
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnpinAllForumTopicMessages, ok=True, result=True)
response: bool = await UnpinAllForumTopicMessages(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "unpinAllForumTopicMessages"
# 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(UnpinAllForumTopicMessages, ok=True, result=True)
response: bool = await bot.unpin_all_forum_topic_messages(
chat_id=42,
message_thread_id=42,
)
request: Request = bot.get_request()
assert request.method == "unpinAllForumTopicMessages"
# assert request.data == {}
assert response == prepare_result.result