Update API

This commit is contained in:
Alex Root Junior 2021-01-24 20:54:38 +02:00
parent 5aeab63384
commit 915c84c742
363 changed files with 1510 additions and 2262 deletions

View file

@ -13,7 +13,8 @@ from tests.mocked_bot import MockedBot
try:
from asynctest import CoroutineMock, patch
except ImportError:
from unittest.mock import AsyncMock as CoroutineMock, patch # type: ignore
from unittest.mock import AsyncMock as CoroutineMock # type: ignore
from unittest.mock import patch
class TestBot:

View file

@ -14,7 +14,8 @@ from tests.mocked_bot import MockedBot
try:
from asynctest import CoroutineMock, patch
except ImportError:
from unittest.mock import AsyncMock as CoroutineMock, patch # type: ignore
from unittest.mock import AsyncMock as CoroutineMock # type: ignore
from unittest.mock import patch
class BareInputFile(InputFile):
@ -212,5 +213,5 @@ class TestAiohttpSession:
) as mocked_close:
async with session as ctx:
assert session == ctx
mocked_close.awaited_once()
mocked_create_session.awaited_once()
mocked_close.assert_awaited_once()
mocked_create_session.assert_awaited_once()

View file

@ -12,7 +12,8 @@ from aiogram.types import UNSET
try:
from asynctest import CoroutineMock, patch
except ImportError:
from unittest.mock import AsyncMock as CoroutineMock, patch # type: ignore
from unittest.mock import AsyncMock as CoroutineMock # type: ignore
from unittest.mock import patch
class CustomSession(BaseSession):
@ -169,4 +170,4 @@ class TestBaseSession:
) as mocked_close:
async with session as ctx:
assert session == ctx
mocked_close.awaited_once()
mocked_close.assert_awaited_once()

View file

@ -21,7 +21,9 @@ class TestSetMyCommands:
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetMyCommands, ok=True, result=None)
response: bool = await bot.set_my_commands(commands=[],)
response: bool = await bot.set_my_commands(
commands=[],
)
request: Request = bot.get_request()
assert request.method == "setMyCommands"
# assert request.data == {}

View file

@ -448,7 +448,12 @@ class TestMessage:
["sticker", dict(sticker="sticker"), SendSticker],
[
"venue",
dict(latitude=0.42, longitude=0.42, title="title", address="address",),
dict(
latitude=0.42,
longitude=0.42,
title="title",
address="address",
),
SendVenue,
],
["video", dict(video="video"), SendVideo],