mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added handling new event type and approve/decline aliases for ChatJoinRequest
This commit is contained in:
parent
7caeeb667f
commit
b34934b3c7
6 changed files with 94 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import ApproveChatJoinRequest, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestApproveChatJoinRequest:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(ApproveChatJoinRequest, ok=True, result=None)
|
||||
|
||||
response: bool = await ApproveChatJoinRequest(
|
||||
chat_id=...,
|
||||
user_id=...,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "approveChatJoinRequest"
|
||||
# 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(ApproveChatJoinRequest, ok=True, result=None)
|
||||
|
||||
response: bool = await bot.approve_chat_join_request(
|
||||
chat_id=...,
|
||||
user_id=...,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "approveChatJoinRequest"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import DeclineChatJoinRequest, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeclineChatJoinRequest:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeclineChatJoinRequest, ok=True, result=None)
|
||||
|
||||
response: bool = await DeclineChatJoinRequest(
|
||||
chat_id=...,
|
||||
user_id=...,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "declineChatJoinRequest"
|
||||
# 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(DeclineChatJoinRequest, ok=True, result=None)
|
||||
|
||||
response: bool = await bot.decline_chat_join_request(
|
||||
chat_id=...,
|
||||
user_id=...,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "declineChatJoinRequest"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
Loading…
Add table
Add a link
Reference in a new issue