Backport text decorations. Improve timeouts in tests. Improve TelegramAPIServer

This commit is contained in:
Alex Root Junior 2021-01-24 23:12:07 +02:00
parent 4292b3934f
commit 1a185928a2
11 changed files with 82 additions and 48 deletions

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.methods import Close, Request
from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.methods import CopyMessage, Request
from aiogram.types import MessageId
from tests.mocked_bot import MockedBot
@ -10,7 +11,9 @@ class TestCopyMessage:
prepare_result = bot.add_result_for(CopyMessage, ok=True, result=MessageId(message_id=42))
response: MessageId = await CopyMessage(
chat_id=42, from_chat_id=42, message_id=42,
chat_id=42,
from_chat_id=42,
message_id=42,
)
request: Request = bot.get_request()
assert request.method == "copyMessage"
@ -22,7 +25,9 @@ class TestCopyMessage:
prepare_result = bot.add_result_for(CopyMessage, ok=True, result=MessageId(message_id=42))
response: MessageId = await bot.copy_message(
chat_id=42, from_chat_id=42, message_id=42,
chat_id=42,
from_chat_id=42,
message_id=42,
)
request: Request = bot.get_request()
assert request.method == "copyMessage"

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.methods import LogOut, Request
from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.methods import Request, UnpinAllChatMessages
from tests.mocked_bot import MockedBot
@ -8,7 +9,9 @@ class TestUnpinAllChatMessages:
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnpinAllChatMessages, ok=True, result=True)
response: bool = await UnpinAllChatMessages(chat_id=42,)
response: bool = await UnpinAllChatMessages(
chat_id=42,
)
request: Request = bot.get_request()
assert request.method == "unpinAllChatMessages"
# assert request.data == {}
@ -18,7 +21,9 @@ class TestUnpinAllChatMessages:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnpinAllChatMessages, ok=True, result=True)
response: bool = await bot.unpin_all_chat_messages(chat_id=42,)
response: bool = await bot.unpin_all_chat_messages(
chat_id=42,
)
request: Request = bot.get_request()
assert request.method == "unpinAllChatMessages"
# assert request.data == {}