mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
* Reworked request builder * Added more default values * Update tests * Fixed timestamp * Fixed Py3.8 support * Describe changes
28 lines
932 B
Python
28 lines
932 B
Python
import datetime
|
|
|
|
from aiogram.methods import Request, SendMessage
|
|
from aiogram.types import Chat, ForceReply, Message
|
|
from tests.mocked_bot import MockedBot
|
|
|
|
|
|
class TestSendMessage:
|
|
async def test_bot_method(self, bot: MockedBot):
|
|
prepare_result = bot.add_result_for(
|
|
SendMessage,
|
|
ok=True,
|
|
result=Message(
|
|
message_id=42,
|
|
date=datetime.datetime.now(),
|
|
text="test",
|
|
chat=Chat(id=42, type="private"),
|
|
),
|
|
)
|
|
|
|
response: Message = await bot.send_message(chat_id=42, text="test")
|
|
request = bot.get_request()
|
|
assert response == prepare_result.result
|
|
|
|
async def test_force_reply(self):
|
|
# https://github.com/aiogram/aiogram/issues/901
|
|
method = SendMessage(text="test", chat_id=42, reply_markup=ForceReply())
|
|
assert isinstance(method.reply_markup, ForceReply)
|