mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
[3.x] Bot API 5.5 (#777)
* Re-generate API, cover changes * Added patchnotes
This commit is contained in:
parent
92ec44d8d2
commit
9ec689b562
22 changed files with 333 additions and 15 deletions
32
tests/test_api/test_methods/test_ban_chat_sender_chat.py
Normal file
32
tests/test_api/test_methods/test_ban_chat_sender_chat.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.methods import BanChatSenderChat, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestBanChatSenderChat:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(BanChatSenderChat, ok=True, result=True)
|
||||
|
||||
response: bool = await BanChatSenderChat(
|
||||
chat_id=-42,
|
||||
sender_chat_id=-1337,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "banChatSenderChat"
|
||||
# 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(BanChatSenderChat, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.ban_chat_sender_chat(
|
||||
chat_id=-42,
|
||||
sender_chat_id=-1337,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "banChatSenderChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
32
tests/test_api/test_methods/test_unban_chat_sender_chat.py
Normal file
32
tests/test_api/test_methods/test_unban_chat_sender_chat.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.methods import Request, UnbanChatSenderChat
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
class TestUnbanChatSenderChat:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(UnbanChatSenderChat, ok=True, result=True)
|
||||
|
||||
response: bool = await UnbanChatSenderChat(
|
||||
chat_id=-42,
|
||||
sender_chat_id=-1337,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "unbanChatSenderChat"
|
||||
# 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(UnbanChatSenderChat, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.unban_chat_sender_chat(
|
||||
chat_id=-42,
|
||||
sender_chat_id=-1337,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "unbanChatSenderChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
17
tests/test_api/test_types/test_chat.py
Normal file
17
tests/test_api/test_types/test_chat.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from aiogram.types import Chat
|
||||
|
||||
|
||||
class TestChat:
|
||||
def test_ban_sender_chat(self):
|
||||
chat = Chat(id=-42, type="supergroup")
|
||||
|
||||
method = chat.ban_sender_chat(sender_chat_id=-1337)
|
||||
assert method.chat_id == chat.id
|
||||
assert method.sender_chat_id == -1337
|
||||
|
||||
def test_unban_sender_chat(self):
|
||||
chat = Chat(id=-42, type="supergroup")
|
||||
|
||||
method = chat.unban_sender_chat(sender_chat_id=-1337)
|
||||
assert method.chat_id == chat.id
|
||||
assert method.sender_chat_id == -1337
|
||||
Loading…
Add table
Add a link
Reference in a new issue