diff --git a/tests/test_dispatcher/test_filters/test_builtin.py b/tests/test_dispatcher/test_filters/test_builtin.py new file mode 100644 index 00000000..86344cec --- /dev/null +++ b/tests/test_dispatcher/test_filters/test_builtin.py @@ -0,0 +1,18 @@ +import pytest + +from aiogram.dispatcher.filters.builtin import Text + + +class TestText: + + @pytest.mark.parametrize('param, key', [ + ('text', 'equals'), + ('text_contains', 'contains'), + ('text_startswith', 'startswith'), + ('text_endswith', 'endswith'), + ]) + def test_validate(self, param, key): + value = 'spam and eggs' + config = {param: value} + res = Text.validate(config) + assert res == {key: value} diff --git a/tests/test_dispatcher/test_filters/test_state.py b/tests/test_dispatcher/test_filters/test_state.py new file mode 100644 index 00000000..b7f5a5fd --- /dev/null +++ b/tests/test_dispatcher/test_filters/test_state.py @@ -0,0 +1,18 @@ +from aiogram.dispatcher.filters.state import StatesGroup + +class TestStatesGroup: + + def test_all_childs(self): + + class InnerState1(StatesGroup): + pass + + class InnerState2(InnerState1): + pass + + class Form(StatesGroup): + inner1 = InnerState1 + inner2 = InnerState2 + + form_childs = Form.all_childs + assert form_childs == (InnerState1, InnerState2)