mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
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:
parent
3ae5d904c9
commit
b287551590
275 changed files with 5821 additions and 1133 deletions
32
tests/test_api/test_methods/test_close_forum_topic.py
Normal file
32
tests/test_api/test_methods/test_close_forum_topic.py
Normal 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
|
||||
41
tests/test_api/test_methods/test_create_forum_topic.py
Normal file
41
tests/test_api/test_methods/test_create_forum_topic.py
Normal 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
|
||||
32
tests/test_api/test_methods/test_delete_forum_topic.py
Normal file
32
tests/test_api/test_methods/test_delete_forum_topic.py
Normal 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
|
||||
37
tests/test_api/test_methods/test_edit_forum_topic.py
Normal file
37
tests/test_api/test_methods/test_edit_forum_topic.py
Normal 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
|
||||
|
|
@ -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
|
||||
32
tests/test_api/test_methods/test_reopen_forum_topic.py
Normal file
32
tests/test_api/test_methods/test_reopen_forum_topic.py
Normal 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
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue