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,
method: Type[TelegramMethod[T]],
ok: bool,
result: Optional[T] = None,
result: T = None,
description: Optional[str] = None,
error_code: Optional[int] = None,
migrate_to_chat_id: Optional[int] = None,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import GetChatMembersCount, Request
from tests.mocked_bot import MockedBot
@ -8,7 +9,7 @@ class TestGetChatMembersCount:
async def test_method(self, bot: MockedBot):
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()
assert request.method == "getChatMembersCount"
assert response == prepare_result.result
@ -17,7 +18,7 @@ class TestGetChatMembersCount:
async def test_bot_method(self, bot: MockedBot):
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()
assert request.method == "getChatMembersCount"
assert response == prepare_result.result

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import LeaveChat, Request
from tests.mocked_bot import MockedBot
@ -8,7 +9,7 @@ class TestLeaveChat:
async def test_method(self, bot: MockedBot):
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()
assert request.method == "leaveChat"
assert response == prepare_result.result
@ -17,7 +18,7 @@ class TestLeaveChat:
async def test_bot_method(self, bot: MockedBot):
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()
assert request.method == "leaveChat"
assert response == prepare_result.result

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import Request, RestrictChatMember
from aiogram.api.types import ChatPermissions
from tests.mocked_bot import MockedBot
@ -10,7 +11,7 @@ class TestRestrictChatMember:
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
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()
assert request.method == "restrictChatMember"
@ -21,7 +22,7 @@ class TestRestrictChatMember:
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
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()
assert request.method == "restrictChatMember"

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
import datetime
import pytest
from aiogram.api.methods import Request, SendContact
from aiogram.api.types import Chat, Contact, Message
from tests.mocked_bot import MockedBot
@ -27,14 +28,20 @@ class TestSendContact:
@pytest.mark.asyncio
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,
date=datetime.datetime.now(),
contact=Contact(phone_number="911", first_name="911"),
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()
assert request.method == "sendContact"
assert response == prepare_result.result

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import Request, SetChatDescription
from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestSetChatDescription:
async def test_method(self, bot: MockedBot):
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()
assert request.method == "setChatDescription"
# assert request.data == {}
@ -19,7 +20,7 @@ class TestSetChatDescription:
async def test_bot_method(self, bot: MockedBot):
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()
assert request.method == "setChatDescription"
# assert request.data == {}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import Request, SetWebhook
from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestSetWebhook:
async def test_method(self, bot: MockedBot):
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()
assert request.method == "setWebhook"
# assert request.data == {}
@ -19,7 +20,7 @@ class TestSetWebhook:
async def test_bot_method(self, bot: MockedBot):
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()
assert request.method == "setWebhook"
# assert request.data == {}

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
import pytest
from aiogram.api.methods import Request, UnpinChatMessage
from tests.mocked_bot import MockedBot
@ -9,7 +10,7 @@ class TestUnpinChatMessage:
async def test_method(self, bot: MockedBot):
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()
assert request.method == "unpinChatMessage"
# assert request.data == {}
@ -19,7 +20,7 @@ class TestUnpinChatMessage:
async def test_bot_method(self, bot: MockedBot):
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()
assert request.method == "unpinChatMessage"
# assert request.data == {}

View file

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