mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
add aliases for edit/delete reply markup to Message (#662)
* add aliases for edit/delete reply markup to Message * add towncrier patch note * add missed towncrier patch note description
This commit is contained in:
parent
04bbc8211c
commit
c1f605c6f5
3 changed files with 78 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ from aiogram.methods import (
|
|||
CopyMessage,
|
||||
DeleteMessage,
|
||||
EditMessageCaption,
|
||||
EditMessageReplyMarkup,
|
||||
EditMessageText,
|
||||
SendAnimation,
|
||||
SendAudio,
|
||||
|
|
@ -36,6 +37,8 @@ from aiogram.types import (
|
|||
Document,
|
||||
EncryptedCredentials,
|
||||
Game,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardMarkup,
|
||||
Invoice,
|
||||
Location,
|
||||
MessageAutoDeleteTimerChanged,
|
||||
|
|
@ -561,6 +564,64 @@ class TestMessage:
|
|||
assert isinstance(method, EditMessageText)
|
||||
assert method.chat_id == message.chat.id
|
||||
|
||||
def test_edit_reply_markup(self):
|
||||
reply_markup = InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="test",
|
||||
callback_data="test",
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
reply_markup_new = InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="test2",
|
||||
callback_data="test2",
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
message = Message(
|
||||
message_id=42,
|
||||
chat=Chat(id=42, type="private"),
|
||||
date=datetime.datetime.now(),
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
method = message.edit_reply_markup(
|
||||
reply_markup=reply_markup_new,
|
||||
)
|
||||
assert isinstance(method, EditMessageReplyMarkup)
|
||||
assert method.reply_markup == reply_markup_new
|
||||
assert method.chat_id == message.chat.id
|
||||
|
||||
def test_delete_reply_markup(self):
|
||||
reply_markup = InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="test",
|
||||
callback_data="test",
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
message = Message(
|
||||
message_id=42,
|
||||
chat=Chat(id=42, type="private"),
|
||||
date=datetime.datetime.now(),
|
||||
reply_markup=reply_markup,
|
||||
)
|
||||
method = message.delete_reply_markup()
|
||||
assert isinstance(method, EditMessageReplyMarkup)
|
||||
assert method.reply_markup is None
|
||||
assert method.chat_id == message.chat.id
|
||||
|
||||
def test_edit_caption(self):
|
||||
message = Message(
|
||||
message_id=42, chat=Chat(id=42, type="private"), date=datetime.datetime.now()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue