2021-07-29 00:40:50 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from aiogram.methods import BanChatMember, Request
|
|
|
|
|
from tests.mocked_bot import MockedBot
|
|
|
|
|
|
2021-08-03 23:40:14 +03:00
|
|
|
pytestmark = pytest.mark.asyncio
|
|
|
|
|
|
2021-07-29 00:40:50 +03:00
|
|
|
|
|
|
|
|
class TestKickChatMember:
|
|
|
|
|
async def test_method(self, bot: MockedBot):
|
|
|
|
|
prepare_result = bot.add_result_for(BanChatMember, ok=True, result=True)
|
|
|
|
|
|
|
|
|
|
response: bool = await BanChatMember(chat_id=-42, user_id=42)
|
|
|
|
|
request: Request = bot.get_request()
|
|
|
|
|
assert request.method == "banChatMember"
|
|
|
|
|
assert response == prepare_result.result
|
|
|
|
|
|
|
|
|
|
async def test_bot_method(self, bot: MockedBot):
|
|
|
|
|
prepare_result = bot.add_result_for(BanChatMember, ok=True, result=True)
|
|
|
|
|
|
|
|
|
|
response: bool = await bot.ban_chat_member(chat_id=-42, user_id=42)
|
|
|
|
|
request: Request = bot.get_request()
|
|
|
|
|
assert request.method == "banChatMember"
|
|
|
|
|
assert response == prepare_result.result
|