Reformate tests code

This commit is contained in:
Alex Root Junior 2019-11-19 00:05:19 +02:00
parent e1b2226d03
commit 5413cf4367
57 changed files with 128 additions and 158 deletions

View file

@ -41,7 +41,7 @@ class MockedBot(Bot):
self, self,
method: Type[TelegramMethod[T]], method: Type[TelegramMethod[T]],
ok: bool, ok: bool,
result: Optional[T] = None, result: T = None,
description: Optional[str] = None, description: Optional[str] = None,
error_code: Optional[int] = None, error_code: Optional[int] = None,
migrate_to_chat_id: Optional[int] = None, migrate_to_chat_id: Optional[int] = None,

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@ import datetime
from typing import Union from typing import Union
import pytest import pytest
from aiogram.api.methods import EditMessageCaption, Request from aiogram.api.methods import EditMessageCaption, Request
from aiogram.api.types import Chat, Message from aiogram.api.types import Chat, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import Union from typing import Union
import pytest import pytest
from aiogram.api.methods import EditMessageLiveLocation, Request from aiogram.api.methods import EditMessageLiveLocation, Request
from aiogram.api.types import Message from aiogram.api.types import Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -12,7 +13,7 @@ class TestEditMessageLiveLocation:
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True) prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True)
response: Union[Message, bool] = await EditMessageLiveLocation( response: Union[Message, bool] = await EditMessageLiveLocation(
latitude=3.141592, longitude=3.141592, latitude=3.141592, longitude=3.141592
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "editMessageLiveLocation" assert request.method == "editMessageLiveLocation"
@ -23,7 +24,7 @@ class TestEditMessageLiveLocation:
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True) prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_live_location( response: Union[Message, bool] = await bot.edit_message_live_location(
latitude=3.141592, longitude=3.141592, latitude=3.141592, longitude=3.141592
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "editMessageLiveLocation" assert request.method == "editMessageLiveLocation"

View file

@ -1,6 +1,7 @@
from typing import Union from typing import Union
import pytest import pytest
from aiogram.api.methods import EditMessageMedia, Request from aiogram.api.methods import EditMessageMedia, Request
from aiogram.api.types import InputMedia, Message from aiogram.api.types import InputMedia, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import Union from typing import Union
import pytest import pytest
from aiogram.api.methods import EditMessageReplyMarkup, Request from aiogram.api.methods import EditMessageReplyMarkup, Request
from aiogram.api.types import InlineKeyboardButton, InlineKeyboardMarkup, Message from aiogram.api.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import Union from typing import Union
import pytest import pytest
from aiogram.api.methods import EditMessageText, Request from aiogram.api.methods import EditMessageText, Request
from aiogram.api.types import Message from aiogram.api.types import Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

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

View file

@ -1,6 +1,7 @@
import datetime import datetime
import pytest import pytest
from aiogram.api.methods import ForwardMessage, Request from aiogram.api.methods import ForwardMessage, Request
from aiogram.api.types import Chat, Message from aiogram.api.types import Chat, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetChat, Request from aiogram.api.methods import GetChat, Request
from aiogram.api.types import Chat from aiogram.api.types import Chat
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import List from typing import List
import pytest import pytest
from aiogram.api.methods import GetChatAdministrators, Request from aiogram.api.methods import GetChatAdministrators, Request
from aiogram.api.types import ChatMember, User from aiogram.api.types import ChatMember, User
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetChatMember, Request from aiogram.api.methods import GetChatMember, Request
from aiogram.api.types import ChatMember, User from aiogram.api.types import ChatMember, User
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetChatMembersCount, Request from aiogram.api.methods import GetChatMembersCount, Request
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -8,7 +9,7 @@ class TestGetChatMembersCount:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42) prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42)
response: int = await GetChatMembersCount(chat_id=-42,) response: int = await GetChatMembersCount(chat_id=-42)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "getChatMembersCount" assert request.method == "getChatMembersCount"
assert response == prepare_result.result assert response == prepare_result.result
@ -17,7 +18,7 @@ class TestGetChatMembersCount:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42) prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42)
response: int = await bot.get_chat_members_count(chat_id=-42,) response: int = await bot.get_chat_members_count(chat_id=-42)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "getChatMembersCount" assert request.method == "getChatMembersCount"
assert response == prepare_result.result assert response == prepare_result.result

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetFile, Request from aiogram.api.methods import GetFile, Request
from aiogram.api.types import File from aiogram.api.types import File
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import List from typing import List
import pytest import pytest
from aiogram.api.methods import GetGameHighScores, Request from aiogram.api.methods import GetGameHighScores, Request
from aiogram.api.types import GameHighScore, User from aiogram.api.types import GameHighScore, User
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetStickerSet, Request from aiogram.api.methods import GetStickerSet, Request
from aiogram.api.types import Sticker, StickerSet from aiogram.api.types import Sticker, StickerSet
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
from typing import List from typing import List
import pytest import pytest
from aiogram.api.methods import GetUpdates, Request from aiogram.api.methods import GetUpdates, Request
from aiogram.api.types import Update from aiogram.api.types import Update
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetUserProfilePhotos, Request from aiogram.api.methods import GetUserProfilePhotos, Request
from aiogram.api.types import PhotoSize, UserProfilePhotos from aiogram.api.types import PhotoSize, UserProfilePhotos
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import GetWebhookInfo, Request from aiogram.api.methods import GetWebhookInfo, Request
from aiogram.api.types import WebhookInfo from aiogram.api.types import WebhookInfo
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import KickChatMember, Request from aiogram.api.methods import KickChatMember, Request
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -8,9 +9,7 @@ class TestKickChatMember:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True) prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True)
response: bool = await KickChatMember( response: bool = await KickChatMember(chat_id=-42, user_id=42)
chat_id=-42, user_id=42,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "kickChatMember" assert request.method == "kickChatMember"
assert response == prepare_result.result assert response == prepare_result.result
@ -19,9 +18,7 @@ class TestKickChatMember:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True) prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True)
response: bool = await bot.kick_chat_member( response: bool = await bot.kick_chat_member(chat_id=-42, user_id=42)
chat_id=-42, user_id=42,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "kickChatMember" assert request.method == "kickChatMember"
assert response == prepare_result.result assert response == prepare_result.result

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import LeaveChat, Request from aiogram.api.methods import LeaveChat, Request
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -8,7 +9,7 @@ class TestLeaveChat:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True) prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True)
response: bool = await LeaveChat(chat_id=-42,) response: bool = await LeaveChat(chat_id=-42)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "leaveChat" assert request.method == "leaveChat"
assert response == prepare_result.result assert response == prepare_result.result
@ -17,7 +18,7 @@ class TestLeaveChat:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True) prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True)
response: bool = await bot.leave_chat(chat_id=-42,) response: bool = await bot.leave_chat(chat_id=-42)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "leaveChat" assert request.method == "leaveChat"
assert response == prepare_result.result assert response == prepare_result.result

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import PinChatMessage, Request from aiogram.api.methods import PinChatMessage, Request
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -8,9 +9,7 @@ class TestPinChatMessage:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True) prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True)
response: bool = await PinChatMessage( response: bool = await PinChatMessage(chat_id=-42, message_id=42)
chat_id=-42, message_id=42,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "pinChatMessage" assert request.method == "pinChatMessage"
assert response == prepare_result.result assert response == prepare_result.result
@ -19,9 +18,7 @@ class TestPinChatMessage:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True) prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True)
response: bool = await bot.pin_chat_message( response: bool = await bot.pin_chat_message(chat_id=-42, message_id=42)
chat_id=-42, message_id=42,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "pinChatMessage" assert request.method == "pinChatMessage"
assert response == prepare_result.result assert response == prepare_result.result

View file

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

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, RestrictChatMember from aiogram.api.methods import Request, RestrictChatMember
from aiogram.api.types import ChatPermissions from aiogram.api.types import ChatPermissions
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -10,7 +11,7 @@ class TestRestrictChatMember:
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True) prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
response: bool = await RestrictChatMember( response: bool = await RestrictChatMember(
chat_id=-42, user_id=42, permissions=ChatPermissions(), chat_id=-42, user_id=42, permissions=ChatPermissions()
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "restrictChatMember" assert request.method == "restrictChatMember"
@ -21,7 +22,7 @@ class TestRestrictChatMember:
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True) prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
response: bool = await bot.restrict_chat_member( response: bool = await bot.restrict_chat_member(
chat_id=-42, user_id=42, permissions=ChatPermissions(), chat_id=-42, user_id=42, permissions=ChatPermissions()
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "restrictChatMember" assert request.method == "restrictChatMember"

View file

@ -1,6 +1,7 @@
import datetime import datetime
import pytest import pytest
from aiogram.api.methods import Request, SendAnimation from aiogram.api.methods import Request, SendAnimation
from aiogram.api.types import Animation, Chat, Message from aiogram.api.types import Animation, Chat, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

@ -1,6 +1,7 @@
import datetime import datetime
import pytest import pytest
from aiogram.api.methods import Request, SendAudio from aiogram.api.methods import Request, SendAudio
from aiogram.api.types import Audio, Chat, File, Message from aiogram.api.types import Audio, Chat, File, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot

View file

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

View file

@ -1,6 +1,7 @@
import datetime import datetime
import pytest import pytest
from aiogram.api.methods import Request, SendContact from aiogram.api.methods import Request, SendContact
from aiogram.api.types import Chat, Contact, Message from aiogram.api.types import Chat, Contact, Message
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -27,14 +28,20 @@ class TestSendContact:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendContact, ok=True, result=Message( prepare_result = bot.add_result_for(
SendContact,
ok=True,
result=Message(
message_id=42, message_id=42,
date=datetime.datetime.now(), date=datetime.datetime.now(),
contact=Contact(phone_number="911", first_name="911"), contact=Contact(phone_number="911", first_name="911"),
chat=Chat(id=42, type="private"), chat=Chat(id=42, type="private"),
),) ),
)
response: Message = await bot.send_contact(chat_id=42, phone_number="911", first_name="911") response: Message = await bot.send_contact(
chat_id=42, phone_number="911", first_name="911"
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendContact" assert request.method == "sendContact"
assert response == prepare_result.result assert response == prepare_result.result

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendDocument from aiogram.api.methods import Request, SendDocument
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendDocument:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendDocument, ok=True, result=None) prepare_result = bot.add_result_for(SendDocument, ok=True, result=None)
response: Message = await SendDocument( response: Message = await SendDocument(chat_id=..., document=...)
chat_id=..., document=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendDocument" assert request.method == "sendDocument"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendDocument:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendDocument, ok=True, result=None) prepare_result = bot.add_result_for(SendDocument, ok=True, result=None)
response: Message = await bot.send_document( response: Message = await bot.send_document(chat_id=..., document=...)
chat_id=..., document=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendDocument" assert request.method == "sendDocument"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendGame from aiogram.api.methods import Request, SendGame
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendGame:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendGame, ok=True, result=None) prepare_result = bot.add_result_for(SendGame, ok=True, result=None)
response: Message = await SendGame( response: Message = await SendGame(chat_id=..., game_short_name=...)
chat_id=..., game_short_name=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendGame" assert request.method == "sendGame"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendGame:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendGame, ok=True, result=None) prepare_result = bot.add_result_for(SendGame, ok=True, result=None)
response: Message = await bot.send_game( response: Message = await bot.send_game(chat_id=..., game_short_name=...)
chat_id=..., game_short_name=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendGame" assert request.method == "sendGame"
# assert request.data == {} # assert request.data == {}

View file

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

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendLocation from aiogram.api.methods import Request, SendLocation
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendLocation:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendLocation, ok=True, result=None) prepare_result = bot.add_result_for(SendLocation, ok=True, result=None)
response: Message = await SendLocation( response: Message = await SendLocation(chat_id=..., latitude=..., longitude=...)
chat_id=..., latitude=..., longitude=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendLocation" assert request.method == "sendLocation"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendLocation:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendLocation, ok=True, result=None) prepare_result = bot.add_result_for(SendLocation, ok=True, result=None)
response: Message = await bot.send_location( response: Message = await bot.send_location(chat_id=..., latitude=..., longitude=...)
chat_id=..., latitude=..., longitude=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendLocation" assert request.method == "sendLocation"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendMediaGroup from aiogram.api.methods import Request, SendMediaGroup
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendMediaGroup:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendMediaGroup, ok=True, result=None) prepare_result = bot.add_result_for(SendMediaGroup, ok=True, result=None)
response: List[Message] = await SendMediaGroup( response: List[Message] = await SendMediaGroup(chat_id=..., media=...)
chat_id=..., media=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendMediaGroup" assert request.method == "sendMediaGroup"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendMediaGroup:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendMediaGroup, ok=True, result=None) prepare_result = bot.add_result_for(SendMediaGroup, ok=True, result=None)
response: List[Message] = await bot.send_media_group( response: List[Message] = await bot.send_media_group(chat_id=..., media=...)
chat_id=..., media=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendMediaGroup" assert request.method == "sendMediaGroup"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendMessage from aiogram.api.methods import Request, SendMessage
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendMessage:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendMessage, ok=True, result=None) prepare_result = bot.add_result_for(SendMessage, ok=True, result=None)
response: Message = await SendMessage( response: Message = await SendMessage(chat_id=..., text=...)
chat_id=..., text=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendMessage" assert request.method == "sendMessage"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendMessage:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendMessage, ok=True, result=None) prepare_result = bot.add_result_for(SendMessage, ok=True, result=None)
response: Message = await bot.send_message( response: Message = await bot.send_message(chat_id=..., text=...)
chat_id=..., text=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendMessage" assert request.method == "sendMessage"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendPhoto from aiogram.api.methods import Request, SendPhoto
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendPhoto:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendPhoto, ok=True, result=None) prepare_result = bot.add_result_for(SendPhoto, ok=True, result=None)
response: Message = await SendPhoto( response: Message = await SendPhoto(chat_id=..., photo=...)
chat_id=..., photo=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendPhoto" assert request.method == "sendPhoto"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendPhoto:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendPhoto, ok=True, result=None) prepare_result = bot.add_result_for(SendPhoto, ok=True, result=None)
response: Message = await bot.send_photo( response: Message = await bot.send_photo(chat_id=..., photo=...)
chat_id=..., photo=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendPhoto" assert request.method == "sendPhoto"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendPoll from aiogram.api.methods import Request, SendPoll
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendPoll:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendPoll, ok=True, result=None) prepare_result = bot.add_result_for(SendPoll, ok=True, result=None)
response: Message = await SendPoll( response: Message = await SendPoll(chat_id=..., question=..., options=...)
chat_id=..., question=..., options=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendPoll" assert request.method == "sendPoll"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendPoll:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendPoll, ok=True, result=None) prepare_result = bot.add_result_for(SendPoll, ok=True, result=None)
response: Message = await bot.send_poll( response: Message = await bot.send_poll(chat_id=..., question=..., options=...)
chat_id=..., question=..., options=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendPoll" assert request.method == "sendPoll"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendSticker from aiogram.api.methods import Request, SendSticker
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendSticker:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendSticker, ok=True, result=None) prepare_result = bot.add_result_for(SendSticker, ok=True, result=None)
response: Message = await SendSticker( response: Message = await SendSticker(chat_id=..., sticker=...)
chat_id=..., sticker=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendSticker" assert request.method == "sendSticker"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendSticker:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendSticker, ok=True, result=None) prepare_result = bot.add_result_for(SendSticker, ok=True, result=None)
response: Message = await bot.send_sticker( response: Message = await bot.send_sticker(chat_id=..., sticker=...)
chat_id=..., sticker=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendSticker" assert request.method == "sendSticker"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendVenue from aiogram.api.methods import Request, SendVenue
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -10,7 +11,7 @@ class TestSendVenue:
prepare_result = bot.add_result_for(SendVenue, ok=True, result=None) prepare_result = bot.add_result_for(SendVenue, ok=True, result=None)
response: Message = await SendVenue( response: Message = await SendVenue(
chat_id=..., latitude=..., longitude=..., title=..., address=..., chat_id=..., latitude=..., longitude=..., title=..., address=...
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVenue" assert request.method == "sendVenue"
@ -22,7 +23,7 @@ class TestSendVenue:
prepare_result = bot.add_result_for(SendVenue, ok=True, result=None) prepare_result = bot.add_result_for(SendVenue, ok=True, result=None)
response: Message = await bot.send_venue( response: Message = await bot.send_venue(
chat_id=..., latitude=..., longitude=..., title=..., address=..., chat_id=..., latitude=..., longitude=..., title=..., address=...
) )
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVenue" assert request.method == "sendVenue"

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendVideo from aiogram.api.methods import Request, SendVideo
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendVideo:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVideo, ok=True, result=None) prepare_result = bot.add_result_for(SendVideo, ok=True, result=None)
response: Message = await SendVideo( response: Message = await SendVideo(chat_id=..., video=...)
chat_id=..., video=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVideo" assert request.method == "sendVideo"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendVideo:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVideo, ok=True, result=None) prepare_result = bot.add_result_for(SendVideo, ok=True, result=None)
response: Message = await bot.send_video( response: Message = await bot.send_video(chat_id=..., video=...)
chat_id=..., video=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVideo" assert request.method == "sendVideo"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendVideoNote from aiogram.api.methods import Request, SendVideoNote
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendVideoNote:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVideoNote, ok=True, result=None) prepare_result = bot.add_result_for(SendVideoNote, ok=True, result=None)
response: Message = await SendVideoNote( response: Message = await SendVideoNote(chat_id=..., video_note=...)
chat_id=..., video_note=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVideoNote" assert request.method == "sendVideoNote"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendVideoNote:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVideoNote, ok=True, result=None) prepare_result = bot.add_result_for(SendVideoNote, ok=True, result=None)
response: Message = await bot.send_video_note( response: Message = await bot.send_video_note(chat_id=..., video_note=...)
chat_id=..., video_note=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVideoNote" assert request.method == "sendVideoNote"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SendVoice from aiogram.api.methods import Request, SendVoice
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSendVoice:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVoice, ok=True, result=None) prepare_result = bot.add_result_for(SendVoice, ok=True, result=None)
response: Message = await SendVoice( response: Message = await SendVoice(chat_id=..., voice=...)
chat_id=..., voice=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVoice" assert request.method == "sendVoice"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSendVoice:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SendVoice, ok=True, result=None) prepare_result = bot.add_result_for(SendVoice, ok=True, result=None)
response: Message = await bot.send_voice( response: Message = await bot.send_voice(chat_id=..., voice=...)
chat_id=..., voice=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "sendVoice" assert request.method == "sendVoice"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetChatDescription from aiogram.api.methods import Request, SetChatDescription
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestSetChatDescription:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatDescription, ok=True, result=None) prepare_result = bot.add_result_for(SetChatDescription, ok=True, result=None)
response: bool = await SetChatDescription(chat_id=...,) response: bool = await SetChatDescription(chat_id=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatDescription" assert request.method == "setChatDescription"
# assert request.data == {} # assert request.data == {}
@ -19,7 +20,7 @@ class TestSetChatDescription:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatDescription, ok=True, result=None) prepare_result = bot.add_result_for(SetChatDescription, ok=True, result=None)
response: bool = await bot.set_chat_description(chat_id=...,) response: bool = await bot.set_chat_description(chat_id=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatDescription" assert request.method == "setChatDescription"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetChatPermissions from aiogram.api.methods import Request, SetChatPermissions
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetChatPermissions:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatPermissions, ok=True, result=None) prepare_result = bot.add_result_for(SetChatPermissions, ok=True, result=None)
response: bool = await SetChatPermissions( response: bool = await SetChatPermissions(chat_id=..., permissions=...)
chat_id=..., permissions=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatPermissions" assert request.method == "setChatPermissions"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetChatPermissions:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatPermissions, ok=True, result=None) prepare_result = bot.add_result_for(SetChatPermissions, ok=True, result=None)
response: bool = await bot.set_chat_permissions( response: bool = await bot.set_chat_permissions(chat_id=..., permissions=...)
chat_id=..., permissions=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatPermissions" assert request.method == "setChatPermissions"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetChatPhoto from aiogram.api.methods import Request, SetChatPhoto
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetChatPhoto:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatPhoto, ok=True, result=None) prepare_result = bot.add_result_for(SetChatPhoto, ok=True, result=None)
response: bool = await SetChatPhoto( response: bool = await SetChatPhoto(chat_id=..., photo=...)
chat_id=..., photo=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatPhoto" assert request.method == "setChatPhoto"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetChatPhoto:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatPhoto, ok=True, result=None) prepare_result = bot.add_result_for(SetChatPhoto, ok=True, result=None)
response: bool = await bot.set_chat_photo( response: bool = await bot.set_chat_photo(chat_id=..., photo=...)
chat_id=..., photo=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatPhoto" assert request.method == "setChatPhoto"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetChatStickerSet from aiogram.api.methods import Request, SetChatStickerSet
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetChatStickerSet:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatStickerSet, ok=True, result=None) prepare_result = bot.add_result_for(SetChatStickerSet, ok=True, result=None)
response: bool = await SetChatStickerSet( response: bool = await SetChatStickerSet(chat_id=..., sticker_set_name=...)
chat_id=..., sticker_set_name=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatStickerSet" assert request.method == "setChatStickerSet"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetChatStickerSet:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatStickerSet, ok=True, result=None) prepare_result = bot.add_result_for(SetChatStickerSet, ok=True, result=None)
response: bool = await bot.set_chat_sticker_set( response: bool = await bot.set_chat_sticker_set(chat_id=..., sticker_set_name=...)
chat_id=..., sticker_set_name=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatStickerSet" assert request.method == "setChatStickerSet"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetChatTitle from aiogram.api.methods import Request, SetChatTitle
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetChatTitle:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatTitle, ok=True, result=None) prepare_result = bot.add_result_for(SetChatTitle, ok=True, result=None)
response: bool = await SetChatTitle( response: bool = await SetChatTitle(chat_id=..., title=...)
chat_id=..., title=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatTitle" assert request.method == "setChatTitle"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetChatTitle:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetChatTitle, ok=True, result=None) prepare_result = bot.add_result_for(SetChatTitle, ok=True, result=None)
response: bool = await bot.set_chat_title( response: bool = await bot.set_chat_title(chat_id=..., title=...)
chat_id=..., title=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setChatTitle" assert request.method == "setChatTitle"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetGameScore from aiogram.api.methods import Request, SetGameScore
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetGameScore:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetGameScore, ok=True, result=None) prepare_result = bot.add_result_for(SetGameScore, ok=True, result=None)
response: Union[Message, bool] = await SetGameScore( response: Union[Message, bool] = await SetGameScore(user_id=..., score=...)
user_id=..., score=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setGameScore" assert request.method == "setGameScore"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetGameScore:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetGameScore, ok=True, result=None) prepare_result = bot.add_result_for(SetGameScore, ok=True, result=None)
response: Union[Message, bool] = await bot.set_game_score( response: Union[Message, bool] = await bot.set_game_score(user_id=..., score=...)
user_id=..., score=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setGameScore" assert request.method == "setGameScore"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetPassportDataErrors from aiogram.api.methods import Request, SetPassportDataErrors
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetPassportDataErrors:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetPassportDataErrors, ok=True, result=None) prepare_result = bot.add_result_for(SetPassportDataErrors, ok=True, result=None)
response: bool = await SetPassportDataErrors( response: bool = await SetPassportDataErrors(user_id=..., errors=...)
user_id=..., errors=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setPassportDataErrors" assert request.method == "setPassportDataErrors"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetPassportDataErrors:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetPassportDataErrors, ok=True, result=None) prepare_result = bot.add_result_for(SetPassportDataErrors, ok=True, result=None)
response: bool = await bot.set_passport_data_errors( response: bool = await bot.set_passport_data_errors(user_id=..., errors=...)
user_id=..., errors=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setPassportDataErrors" assert request.method == "setPassportDataErrors"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetStickerPositionInSet from aiogram.api.methods import Request, SetStickerPositionInSet
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestSetStickerPositionInSet:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetStickerPositionInSet, ok=True, result=None) prepare_result = bot.add_result_for(SetStickerPositionInSet, ok=True, result=None)
response: bool = await SetStickerPositionInSet( response: bool = await SetStickerPositionInSet(sticker=..., position=...)
sticker=..., position=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setStickerPositionInSet" assert request.method == "setStickerPositionInSet"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestSetStickerPositionInSet:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetStickerPositionInSet, ok=True, result=None) prepare_result = bot.add_result_for(SetStickerPositionInSet, ok=True, result=None)
response: bool = await bot.set_sticker_position_in_set( response: bool = await bot.set_sticker_position_in_set(sticker=..., position=...)
sticker=..., position=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setStickerPositionInSet" assert request.method == "setStickerPositionInSet"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, SetWebhook from aiogram.api.methods import Request, SetWebhook
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestSetWebhook:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetWebhook, ok=True, result=None) prepare_result = bot.add_result_for(SetWebhook, ok=True, result=None)
response: bool = await SetWebhook(url=...,) response: bool = await SetWebhook(url=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setWebhook" assert request.method == "setWebhook"
# assert request.data == {} # assert request.data == {}
@ -19,7 +20,7 @@ class TestSetWebhook:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(SetWebhook, ok=True, result=None) prepare_result = bot.add_result_for(SetWebhook, ok=True, result=None)
response: bool = await bot.set_webhook(url=...,) response: bool = await bot.set_webhook(url=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "setWebhook" assert request.method == "setWebhook"
# assert request.data == {} # assert request.data == {}

View file

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

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, StopPoll from aiogram.api.methods import Request, StopPoll
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestStopPoll:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(StopPoll, ok=True, result=None) prepare_result = bot.add_result_for(StopPoll, ok=True, result=None)
response: Poll = await StopPoll( response: Poll = await StopPoll(chat_id=..., message_id=...)
chat_id=..., message_id=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "stopPoll" assert request.method == "stopPoll"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestStopPoll:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(StopPoll, ok=True, result=None) prepare_result = bot.add_result_for(StopPoll, ok=True, result=None)
response: Poll = await bot.stop_poll( response: Poll = await bot.stop_poll(chat_id=..., message_id=...)
chat_id=..., message_id=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "stopPoll" assert request.method == "stopPoll"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, UnbanChatMember from aiogram.api.methods import Request, UnbanChatMember
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestUnbanChatMember:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnbanChatMember, ok=True, result=None) prepare_result = bot.add_result_for(UnbanChatMember, ok=True, result=None)
response: bool = await UnbanChatMember( response: bool = await UnbanChatMember(chat_id=..., user_id=...)
chat_id=..., user_id=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "unbanChatMember" assert request.method == "unbanChatMember"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestUnbanChatMember:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnbanChatMember, ok=True, result=None) prepare_result = bot.add_result_for(UnbanChatMember, ok=True, result=None)
response: bool = await bot.unban_chat_member( response: bool = await bot.unban_chat_member(chat_id=..., user_id=...)
chat_id=..., user_id=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "unbanChatMember" assert request.method == "unbanChatMember"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, UnpinChatMessage from aiogram.api.methods import Request, UnpinChatMessage
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestUnpinChatMessage:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnpinChatMessage, ok=True, result=None) prepare_result = bot.add_result_for(UnpinChatMessage, ok=True, result=None)
response: bool = await UnpinChatMessage(chat_id=...,) response: bool = await UnpinChatMessage(chat_id=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "unpinChatMessage" assert request.method == "unpinChatMessage"
# assert request.data == {} # assert request.data == {}
@ -19,7 +20,7 @@ class TestUnpinChatMessage:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UnpinChatMessage, ok=True, result=None) prepare_result = bot.add_result_for(UnpinChatMessage, ok=True, result=None)
response: bool = await bot.unpin_chat_message(chat_id=...,) response: bool = await bot.unpin_chat_message(chat_id=...)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "unpinChatMessage" assert request.method == "unpinChatMessage"
# assert request.data == {} # assert request.data == {}

View file

@ -1,4 +1,5 @@
import pytest import pytest
from aiogram.api.methods import Request, UploadStickerFile from aiogram.api.methods import Request, UploadStickerFile
from tests.mocked_bot import MockedBot from tests.mocked_bot import MockedBot
@ -9,9 +10,7 @@ class TestUploadStickerFile:
async def test_method(self, bot: MockedBot): async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UploadStickerFile, ok=True, result=None) prepare_result = bot.add_result_for(UploadStickerFile, ok=True, result=None)
response: File = await UploadStickerFile( response: File = await UploadStickerFile(user_id=..., png_sticker=...)
user_id=..., png_sticker=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "uploadStickerFile" assert request.method == "uploadStickerFile"
# assert request.data == {} # assert request.data == {}
@ -21,9 +20,7 @@ class TestUploadStickerFile:
async def test_bot_method(self, bot: MockedBot): async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(UploadStickerFile, ok=True, result=None) prepare_result = bot.add_result_for(UploadStickerFile, ok=True, result=None)
response: File = await bot.upload_sticker_file( response: File = await bot.upload_sticker_file(user_id=..., png_sticker=...)
user_id=..., png_sticker=...,
)
request: Request = bot.get_request() request: Request = bot.get_request()
assert request.method == "uploadStickerFile" assert request.method == "uploadStickerFile"
# assert request.data == {} # assert request.data == {}