mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
AIOG-T-20 Revert overriding remove keyboard default value and add tests
This commit is contained in:
parent
2372322aef
commit
4a86bc63c8
2 changed files with 20 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ class ReplyKeyboardRemove(MutableTelegramObject):
|
|||
Source: https://core.telegram.org/bots/api#replykeyboardremove
|
||||
"""
|
||||
|
||||
remove_keyboard: bool
|
||||
remove_keyboard: bool = True
|
||||
"""Requests clients to remove the custom keyboard (user will not be able to summon this
|
||||
keyboard; if you want to hide the keyboard from sight but keep it accessible, use
|
||||
one_time_keyboard in ReplyKeyboardMarkup)"""
|
||||
|
|
|
|||
19
tests/test_api/test_types/test_reply_keyboard_remove.py
Normal file
19
tests/test_api/test_types/test_reply_keyboard_remove.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import pytest
|
||||
|
||||
from aiogram.api.types import ReplyKeyboardRemove
|
||||
|
||||
|
||||
class TestReplyKeyboardRemove:
|
||||
"""
|
||||
This test is needed to prevent to override value by code generator
|
||||
"""
|
||||
|
||||
def test_remove_keyboard_default_is_true(self):
|
||||
assert ReplyKeyboardRemove.__fields__["remove_keyboard"].default is True
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"kwargs,expected",
|
||||
[[{}, True], [{"remove_keyboard": True}, True], [{"remove_keyboard": False}, False]],
|
||||
)
|
||||
def test_remove_keyboard_values(self, kwargs, expected):
|
||||
assert ReplyKeyboardRemove(**kwargs).remove_keyboard is expected
|
||||
Loading…
Add table
Add a link
Reference in a new issue