aiogram/tests/test_dispatcher/test_deprecated.py
Alex Root Junior 4008a3114d
Upgrade architecture + 5.0 Bot API (#469)
Upgrade architecture + 5.0 Bot API (#469)
* Moved `methods`, `types` and `client` to root package
* Removed update handler from routers to dispatcher
* Reworked events propagation mechanism to handlers
* Reworked inner middlewares logic (very small change)
* Updated to Bot API 5.0
* Initial migration from MkDocs to Sphinx + config for readthedocs
2021-01-26 21:20:52 +02:00

31 lines
825 B
Python

import pytest
from aiogram.dispatcher.event.telegram import TelegramEventObserver
from aiogram.dispatcher.router import Router
from tests.deprecated import check_deprecated
OBSERVERS = {
"callback_query",
"channel_post",
"chosen_inline_result",
"edited_channel_post",
"edited_message",
"errors",
"inline_query",
"message",
"poll",
"poll_answer",
"pre_checkout_query",
"shipping_query",
}
DEPRECATED_OBSERVERS = {observer + "_handler" for observer in OBSERVERS}
@pytest.mark.parametrize("observer_name", DEPRECATED_OBSERVERS)
def test_deprecated_handlers_name(observer_name: str):
router = Router()
with check_deprecated("3.2", exception=AttributeError):
observer = getattr(router, observer_name)
assert isinstance(observer, TelegramEventObserver)