mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Enable 37 auto-generated tests
This commit is contained in:
parent
567584b741
commit
e1b2226d03
37 changed files with 387 additions and 287 deletions
|
|
@ -1,30 +1,28 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import AddStickerToSet, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestAddStickerToSet:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AddStickerToSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AddStickerToSet, ok=True, result=True)
|
||||
|
||||
response: bool = await AddStickerToSet(
|
||||
user_id=..., name=..., png_sticker=..., emojis=...,
|
||||
user_id=42, name="test stickers pack", png_sticker="file id", emojis=":)"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "addStickerToSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AddStickerToSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AddStickerToSet, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.add_sticker_to_set(
|
||||
user_id=..., name=..., png_sticker=..., emojis=...,
|
||||
user_id=42, name="test stickers pack", png_sticker="file id", emojis=":)"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "addStickerToSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import AnswerCallbackQuery, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestAnswerCallbackQuery:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerCallbackQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerCallbackQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await AnswerCallbackQuery(callback_query_id=...,)
|
||||
response: bool = await AnswerCallbackQuery(callback_query_id="cq id", text="OK")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerCallbackQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerCallbackQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerCallbackQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.answer_callback_query(callback_query_id=...,)
|
||||
response: bool = await bot.answer_callback_query(callback_query_id="cq id", text="OK")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerCallbackQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,29 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import AnswerInlineQuery, Request
|
||||
from aiogram.api.types import InlineQueryResult
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestAnswerInlineQuery:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerInlineQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerInlineQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await AnswerInlineQuery(
|
||||
inline_query_id=..., results=...,
|
||||
inline_query_id="query id", results=[InlineQueryResult()]
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerInlineQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerInlineQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerInlineQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.answer_inline_query(
|
||||
inline_query_id=..., results=...,
|
||||
inline_query_id="query id", results=[InlineQueryResult()]
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerInlineQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,26 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import AnswerPreCheckoutQuery, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestAnswerPreCheckoutQuery:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerPreCheckoutQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerPreCheckoutQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await AnswerPreCheckoutQuery(
|
||||
pre_checkout_query_id=..., ok=...,
|
||||
)
|
||||
response: bool = await AnswerPreCheckoutQuery(pre_checkout_query_id="query id", ok=True)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerPreCheckoutQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerPreCheckoutQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerPreCheckoutQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.answer_pre_checkout_query(
|
||||
pre_checkout_query_id=..., ok=...,
|
||||
pre_checkout_query_id="query id", ok=True
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerPreCheckoutQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import AnswerShippingQuery, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestAnswerShippingQuery:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerShippingQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerShippingQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await AnswerShippingQuery(
|
||||
shipping_query_id=..., ok=...,
|
||||
)
|
||||
response: bool = await AnswerShippingQuery(shipping_query_id="query id", ok=True)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerShippingQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(AnswerShippingQuery, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(AnswerShippingQuery, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.answer_shipping_query(
|
||||
shipping_query_id=..., ok=...,
|
||||
)
|
||||
response: bool = await bot.answer_shipping_query(shipping_query_id="query id", ok=True)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "answerShippingQuery"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import CreateNewStickerSet, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestCreateNewStickerSet:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(CreateNewStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(CreateNewStickerSet, ok=True, result=True)
|
||||
|
||||
response: bool = await CreateNewStickerSet(
|
||||
user_id=..., name=..., title=..., png_sticker=..., emojis=...,
|
||||
user_id=42, name="name", title="title", png_sticker="file id", emojis=":)"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "createNewStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(CreateNewStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(CreateNewStickerSet, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.create_new_sticker_set(
|
||||
user_id=..., name=..., title=..., png_sticker=..., emojis=...,
|
||||
user_id=42, name="name", title="title", png_sticker="file id", emojis=":)"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "createNewStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import DeleteChatPhoto, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeleteChatPhoto:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteChatPhoto, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteChatPhoto, ok=True, result=True)
|
||||
|
||||
response: bool = await DeleteChatPhoto(chat_id=...,)
|
||||
response: bool = await DeleteChatPhoto(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteChatPhoto"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteChatPhoto, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteChatPhoto, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.delete_chat_photo(chat_id=...,)
|
||||
response: bool = await bot.delete_chat_photo(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteChatPhoto"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.methods import DeleteChatStickerSet, Request
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeleteChatStickerSet:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteChatStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteChatStickerSet, ok=True, result=True)
|
||||
|
||||
response: bool = await DeleteChatStickerSet(chat_id=...,)
|
||||
response: bool = await DeleteChatStickerSet(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteChatStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteChatStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteChatStickerSet, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.delete_chat_sticker_set(chat_id=...,)
|
||||
response: bool = await bot.delete_chat_sticker_set(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteChatStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,28 +3,21 @@ from aiogram.api.methods import DeleteMessage, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeleteMessage:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteMessage, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteMessage, ok=True, result=True)
|
||||
|
||||
response: bool = await DeleteMessage(
|
||||
chat_id=..., message_id=...,
|
||||
)
|
||||
response: bool = await DeleteMessage(chat_id=42, message_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteMessage"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteMessage, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteMessage, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.delete_message(
|
||||
chat_id=..., message_id=...,
|
||||
)
|
||||
response: bool = await bot.delete_message(chat_id=42, message_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteMessage"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,24 +3,21 @@ from aiogram.api.methods import DeleteStickerFromSet, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeleteStickerFromSet:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteStickerFromSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteStickerFromSet, ok=True, result=True)
|
||||
|
||||
response: bool = await DeleteStickerFromSet(sticker=...,)
|
||||
response: bool = await DeleteStickerFromSet(sticker="sticker id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteStickerFromSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteStickerFromSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteStickerFromSet, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.delete_sticker_from_set(sticker=...,)
|
||||
response: bool = await bot.delete_sticker_from_set(sticker="sticker id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteStickerFromSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,24 +3,21 @@ from aiogram.api.methods import DeleteWebhook, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestDeleteWebhook:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteWebhook, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteWebhook, ok=True, result=True)
|
||||
|
||||
response: bool = await DeleteWebhook()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteWebhook"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(DeleteWebhook, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(DeleteWebhook, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.delete_webhook()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "deleteWebhook"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,45 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestEditMessageCaption:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageCaption, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
EditMessageCaption,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
text="text",
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Union[Message, bool] = await EditMessageCaption()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageCaption"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageCaption, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
EditMessageCaption,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
text="text",
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Union[Message, bool] = await bot.edit_message_caption()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageCaption"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestEditMessageLiveLocation:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await EditMessageLiveLocation(
|
||||
latitude=..., longitude=...,
|
||||
latitude=3.141592, longitude=3.141592,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageLiveLocation"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageLiveLocation, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await bot.edit_message_live_location(
|
||||
latitude=..., longitude=...,
|
||||
latitude=3.141592, longitude=3.141592,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageLiveLocation"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestEditMessageMedia:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageMedia, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageMedia, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await EditMessageMedia(media=...,)
|
||||
response: Union[Message, bool] = await EditMessageMedia(media=InputMedia())
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageMedia"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageMedia, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageMedia, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await bot.edit_message_media(media=...,)
|
||||
response: Union[Message, bool] = await bot.edit_message_media(media=InputMedia())
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageMedia"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,42 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestEditMessageReplyMarkup:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageReplyMarkup, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageReplyMarkup, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await EditMessageReplyMarkup()
|
||||
response: Union[Message, bool] = await EditMessageReplyMarkup(
|
||||
chat_id=42,
|
||||
inline_message_id="inline message id",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[InlineKeyboardButton(text="button", callback_data="placeholder")]
|
||||
]
|
||||
),
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageReplyMarkup"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageReplyMarkup, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageReplyMarkup, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await bot.edit_message_reply_markup()
|
||||
response: Union[Message, bool] = await bot.edit_message_reply_markup(
|
||||
chat_id=42,
|
||||
inline_message_id="inline message id",
|
||||
reply_markup=InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[InlineKeyboardButton(text="button", callback_data="placeholder")]
|
||||
]
|
||||
),
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageReplyMarkup"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,30 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestEditMessageText:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await EditMessageText(text=...,)
|
||||
response: Union[Message, bool] = await EditMessageText(
|
||||
chat_id=42, inline_message_id="inline message id", text="text"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageText"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=True)
|
||||
|
||||
response: Union[Message, bool] = await bot.edit_message_text(text=...,)
|
||||
response: Union[Message, bool] = await bot.edit_message_text(
|
||||
chat_id=42, inline_message_id="inline message id", text="text"
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "editMessageText"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,24 +3,25 @@ from aiogram.api.methods import ExportChatInviteLink, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestExportChatInviteLink:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(ExportChatInviteLink, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
ExportChatInviteLink, ok=True, result="http://example.com"
|
||||
)
|
||||
|
||||
response: str = await ExportChatInviteLink(chat_id=...,)
|
||||
response: str = await ExportChatInviteLink(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "exportChatInviteLink"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(ExportChatInviteLink, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
ExportChatInviteLink, ok=True, result="http://example.com"
|
||||
)
|
||||
|
||||
response: str = await bot.export_chat_invite_link(chat_id=...,)
|
||||
response: str = await bot.export_chat_invite_link(chat_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "exportChatInviteLink"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,17 +1,26 @@
|
|||
import datetime
|
||||
|
||||
import pytest
|
||||
from aiogram.api.methods import ForwardMessage, Request
|
||||
from aiogram.api.types import Chat, Message
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestForwardMessage:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(ForwardMessage, ok=True, result=None)
|
||||
|
||||
response: Message = await ForwardMessage(
|
||||
chat_id=..., from_chat_id=..., message_id=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
ForwardMessage,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, title="chat", type="private"),
|
||||
text="text",
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await ForwardMessage(chat_id=42, from_chat_id=42, message_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "forwardMessage"
|
||||
# assert request.data == {}
|
||||
|
|
@ -19,11 +28,18 @@ class TestForwardMessage:
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(ForwardMessage, ok=True, result=None)
|
||||
|
||||
response: Message = await bot.forward_message(
|
||||
chat_id=..., from_chat_id=..., message_id=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
ForwardMessage,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
chat=Chat(id=42, title="chat", type="private"),
|
||||
text="text",
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await bot.forward_message(chat_id=42, from_chat_id=42, message_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "forwardMessage"
|
||||
# assert request.data == {}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetChat, Request
|
||||
from aiogram.api.types import Chat
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetChat:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChat, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChat, ok=True, result=Chat(id=-42, type="channel", title="chat")
|
||||
)
|
||||
|
||||
response: Chat = await GetChat(chat_id=...,)
|
||||
response: Chat = await GetChat(chat_id=-42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChat, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChat, ok=True, result=Chat(id=-42, type="channel", title="chat")
|
||||
)
|
||||
|
||||
response: Chat = await bot.get_chat(chat_id=...,)
|
||||
response: Chat = await bot.get_chat(chat_id=-42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,37 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetChatAdministrators:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatAdministrators, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatAdministrators,
|
||||
ok=True,
|
||||
result=[
|
||||
ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator")
|
||||
],
|
||||
)
|
||||
|
||||
response: List[ChatMember] = await GetChatAdministrators(chat_id=...,)
|
||||
response: List[ChatMember] = await GetChatAdministrators(chat_id=-42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatAdministrators"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatAdministrators, ok=True, result=None)
|
||||
|
||||
response: List[ChatMember] = await bot.get_chat_administrators(chat_id=...,)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatAdministrators,
|
||||
ok=True,
|
||||
result=[
|
||||
ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator")
|
||||
],
|
||||
)
|
||||
response: List[ChatMember] = await bot.get_chat_administrators(chat_id=-42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatAdministrators"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,32 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetChatMember, Request
|
||||
from aiogram.api.types import ChatMember, User
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetChatMember:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatMember, ok=True, result=None)
|
||||
|
||||
response: ChatMember = await GetChatMember(
|
||||
chat_id=..., user_id=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatMember,
|
||||
ok=True,
|
||||
result=ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator"),
|
||||
)
|
||||
|
||||
response: ChatMember = await GetChatMember(chat_id=-42, user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatMember, ok=True, result=None)
|
||||
|
||||
response: ChatMember = await bot.get_chat_member(
|
||||
chat_id=..., user_id=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
GetChatMember,
|
||||
ok=True,
|
||||
result=ChatMember(user=User(id=42, is_bot=False, first_name="User"), status="creator"),
|
||||
)
|
||||
|
||||
response: ChatMember = await bot.get_chat_member(chat_id=-42, user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,24 +3,21 @@ from aiogram.api.methods import GetChatMembersCount, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetChatMembersCount:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42)
|
||||
|
||||
response: int = await GetChatMembersCount(chat_id=...,)
|
||||
response: int = await GetChatMembersCount(chat_id=-42,)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatMembersCount"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetChatMembersCount, ok=True, result=42)
|
||||
|
||||
response: int = await bot.get_chat_members_count(chat_id=...,)
|
||||
response: int = await bot.get_chat_members_count(chat_id=-42,)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getChatMembersCount"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetFile, Request
|
||||
from aiogram.api.types import File
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetFile:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetFile, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetFile, ok=True, result=File(file_id="file id"))
|
||||
|
||||
response: File = await GetFile(file_id=...,)
|
||||
response: File = await GetFile(file_id="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getFile"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetFile, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetFile, ok=True, result=File(file_id="file id"))
|
||||
|
||||
response: File = await bot.get_file(file_id=...,)
|
||||
response: File = await bot.get_file(file_id="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getFile"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,42 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetGameHighScores:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetGameHighScores, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetGameHighScores,
|
||||
ok=True,
|
||||
result=[
|
||||
GameHighScore(
|
||||
position=1, user=User(id=42, is_bot=False, first_name="User"), score=42
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[GameHighScore] = await GetGameHighScores(user_id=...,)
|
||||
response: List[GameHighScore] = await GetGameHighScores(user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getGameHighScores"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetGameHighScores, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetGameHighScores,
|
||||
ok=True,
|
||||
result=[
|
||||
GameHighScore(
|
||||
position=1, user=User(id=42, is_bot=False, first_name="User"), score=42
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
response: List[GameHighScore] = await bot.get_game_high_scores(user_id=...,)
|
||||
response: List[GameHighScore] = await bot.get_game_high_scores(user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getGameHighScores"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,44 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetStickerSet, Request
|
||||
from aiogram.api.types import Sticker, StickerSet
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetStickerSet:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetStickerSet,
|
||||
ok=True,
|
||||
result=StickerSet(
|
||||
name="test",
|
||||
title="test",
|
||||
is_animated=False,
|
||||
contains_masks=False,
|
||||
stickers=[Sticker(file_id="file if", width=42, height=42, is_animated=False)],
|
||||
),
|
||||
)
|
||||
|
||||
response: StickerSet = await GetStickerSet(name=...,)
|
||||
response: StickerSet = await GetStickerSet(name="test")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetStickerSet, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetStickerSet,
|
||||
ok=True,
|
||||
result=StickerSet(
|
||||
name="test",
|
||||
title="test",
|
||||
is_animated=False,
|
||||
contains_masks=False,
|
||||
stickers=[Sticker(file_id="file if", width=42, height=42, is_animated=False)],
|
||||
),
|
||||
)
|
||||
|
||||
response: StickerSet = await bot.get_sticker_set(name=...,)
|
||||
response: StickerSet = await bot.get_sticker_set(name="test")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getStickerSet"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetUpdates:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetUpdates, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetUpdates, ok=True, result=[Update(update_id=42)])
|
||||
|
||||
response: List[Update] = await GetUpdates()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getUpdates"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetUpdates, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(GetUpdates, ok=True, result=[Update(update_id=42)])
|
||||
|
||||
response: List[Update] = await bot.get_updates()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getUpdates"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetUserProfilePhotos, Request
|
||||
from aiogram.api.types import PhotoSize, UserProfilePhotos
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
|
|
@ -7,20 +8,30 @@ from tests.mocked_bot import MockedBot
|
|||
class TestGetUserProfilePhotos:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetUserProfilePhotos, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetUserProfilePhotos,
|
||||
ok=True,
|
||||
result=UserProfilePhotos(
|
||||
total_count=1, photos=[[PhotoSize(file_id="file_id", width=42, height=42)]]
|
||||
),
|
||||
)
|
||||
|
||||
response: UserProfilePhotos = await GetUserProfilePhotos(user_id=...,)
|
||||
response: UserProfilePhotos = await GetUserProfilePhotos(user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getUserProfilePhotos"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetUserProfilePhotos, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetUserProfilePhotos,
|
||||
ok=True,
|
||||
result=UserProfilePhotos(
|
||||
total_count=1, photos=[[PhotoSize(file_id="file_id", width=42, height=42)]]
|
||||
),
|
||||
)
|
||||
|
||||
response: UserProfilePhotos = await bot.get_user_profile_photos(user_id=...,)
|
||||
response: UserProfilePhotos = await bot.get_user_profile_photos(user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getUserProfilePhotos"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,26 +1,36 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import GetWebhookInfo, Request
|
||||
from aiogram.api.types import WebhookInfo
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestGetWebhookInfo:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetWebhookInfo, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetWebhookInfo,
|
||||
ok=True,
|
||||
result=WebhookInfo(
|
||||
url="https://example.com", has_custom_certificate=False, pending_update_count=0
|
||||
),
|
||||
)
|
||||
|
||||
response: WebhookInfo = await GetWebhookInfo()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getWebhookInfo"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(GetWebhookInfo, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(
|
||||
GetWebhookInfo,
|
||||
ok=True,
|
||||
result=WebhookInfo(
|
||||
url="https://example.com", has_custom_certificate=False, pending_update_count=0
|
||||
),
|
||||
)
|
||||
|
||||
response: WebhookInfo = await bot.get_webhook_info()
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "getWebhookInfo"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,28 +3,25 @@ from aiogram.api.methods import KickChatMember, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestKickChatMember:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await KickChatMember(
|
||||
chat_id=..., user_id=...,
|
||||
chat_id=-42, user_id=42,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "kickChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(KickChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.kick_chat_member(
|
||||
chat_id=..., user_id=...,
|
||||
chat_id=-42, user_id=42,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "kickChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,24 +3,21 @@ from aiogram.api.methods import LeaveChat, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestLeaveChat:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True)
|
||||
|
||||
response: bool = await LeaveChat(chat_id=...,)
|
||||
response: bool = await LeaveChat(chat_id=-42,)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "leaveChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(LeaveChat, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.leave_chat(chat_id=...,)
|
||||
response: bool = await bot.leave_chat(chat_id=-42,)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "leaveChat"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,28 +3,25 @@ from aiogram.api.methods import PinChatMessage, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestPinChatMessage:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True)
|
||||
|
||||
response: bool = await PinChatMessage(
|
||||
chat_id=..., message_id=...,
|
||||
chat_id=-42, message_id=42,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "pinChatMessage"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(PinChatMessage, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.pin_chat_message(
|
||||
chat_id=..., message_id=...,
|
||||
chat_id=-42, message_id=42,
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "pinChatMessage"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,28 +3,21 @@ from aiogram.api.methods import PromoteChatMember, Request
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestPromoteChatMember:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(PromoteChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(PromoteChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await PromoteChatMember(
|
||||
chat_id=..., user_id=...,
|
||||
)
|
||||
response: bool = await PromoteChatMember(chat_id=-42, user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "promoteChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(PromoteChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(PromoteChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.promote_chat_member(
|
||||
chat_id=..., user_id=...,
|
||||
)
|
||||
response: bool = await bot.promote_chat_member(chat_id=-42, user_id=42)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "promoteChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
import pytest
|
||||
from aiogram.api.methods import Request, RestrictChatMember
|
||||
from aiogram.api.types import ChatPermissions
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestRestrictChatMember:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await RestrictChatMember(
|
||||
chat_id=..., user_id=..., permissions=...,
|
||||
chat_id=-42, user_id=42, permissions=ChatPermissions(),
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "restrictChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(RestrictChatMember, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.restrict_chat_member(
|
||||
chat_id=..., user_id=..., permissions=...,
|
||||
chat_id=-42, user_id=42, permissions=ChatPermissions(),
|
||||
)
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "restrictChatMember"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,44 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestSendAnimation:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendAnimation, ok=True, result=None)
|
||||
|
||||
response: Message = await SendAnimation(
|
||||
chat_id=..., animation=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
SendAnimation,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
animation=Animation(file_id="file id", width=42, height=42, duration=0),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await SendAnimation(chat_id=42, animation="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendAnimation"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendAnimation, ok=True, result=None)
|
||||
|
||||
response: Message = await bot.send_animation(
|
||||
chat_id=..., animation=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
SendAnimation,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
animation=Animation(file_id="file id", width=42, height=42, duration=0),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await bot.send_animation(chat_id=42, animation="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendAnimation"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,44 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestSendAudio:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendAudio, ok=True, result=None)
|
||||
|
||||
response: Message = await SendAudio(
|
||||
chat_id=..., audio=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
SendAudio,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
audio=Audio(file_id="file id", duration=42),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await SendAudio(chat_id=42, audio="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendAudio"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendAudio, ok=True, result=None)
|
||||
|
||||
response: Message = await bot.send_audio(
|
||||
chat_id=..., audio=...,
|
||||
prepare_result = bot.add_result_for(
|
||||
SendAudio,
|
||||
ok=True,
|
||||
result=Message(
|
||||
message_id=42,
|
||||
date=datetime.datetime.now(),
|
||||
audio=Audio(file_id="file id", duration=42),
|
||||
chat=Chat(id=42, type="private"),
|
||||
),
|
||||
)
|
||||
|
||||
response: Message = await bot.send_audio(chat_id=42, audio="file id")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendAudio"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -3,28 +3,21 @@ from aiogram.api.methods import Request, SendChatAction
|
|||
from tests.mocked_bot import MockedBot
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestSendChatAction:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendChatAction, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(SendChatAction, ok=True, result=True)
|
||||
|
||||
response: bool = await SendChatAction(
|
||||
chat_id=..., action=...,
|
||||
)
|
||||
response: bool = await SendChatAction(chat_id=42, action="typing")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendChatAction"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendChatAction, ok=True, result=None)
|
||||
prepare_result = bot.add_result_for(SendChatAction, ok=True, result=True)
|
||||
|
||||
response: bool = await bot.send_chat_action(
|
||||
chat_id=..., action=...,
|
||||
)
|
||||
response: bool = await bot.send_chat_action(chat_id=42, action="typing")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendChatAction"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
|
|
@ -1,30 +1,40 @@
|
|||
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
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
class TestSendContact:
|
||||
@pytest.mark.asyncio
|
||||
async def test_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendContact, ok=True, result=None)
|
||||
|
||||
response: Message = await SendContact(
|
||||
chat_id=..., phone_number=..., first_name=...,
|
||||
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 SendContact(chat_id=42, phone_number="911", first_name="911")
|
||||
request: Request = bot.get_request()
|
||||
assert request.method == "sendContact"
|
||||
# assert request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bot_method(self, bot: MockedBot):
|
||||
prepare_result = bot.add_result_for(SendContact, ok=True, result=None)
|
||||
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=..., phone_number=..., first_name=...,
|
||||
)
|
||||
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 request.data == {}
|
||||
assert response == prepare_result.result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue