AIOG-T-20 Revert overriding remove keyboard default value and add tests

This commit is contained in:
Alex Root Junior 2020-05-02 22:47:58 +03:00
parent 2372322aef
commit 4a86bc63c8
2 changed files with 20 additions and 1 deletions

View file

@ -15,7 +15,7 @@ class ReplyKeyboardRemove(MutableTelegramObject):
Source: https://core.telegram.org/bots/api#replykeyboardremove 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 """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 keyboard; if you want to hide the keyboard from sight but keep it accessible, use
one_time_keyboard in ReplyKeyboardMarkup)""" one_time_keyboard in ReplyKeyboardMarkup)"""

View 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