Move router validation to Router.parent_router

This commit is contained in:
Alex Root Junior 2019-12-15 22:01:13 +02:00
parent 390648aae6
commit 9c2a3d1324
2 changed files with 10 additions and 4 deletions

View file

@ -2,7 +2,6 @@ import datetime
from typing import Any
import pytest
from aiogram.api.types import (
CallbackQuery,
Chat,
@ -71,6 +70,11 @@ class TestRouter:
with pytest.raises(ValueError, match=r"router should be instance of Router"):
router.include_router("tests.test_dispatcher.test_router:TestRouter")
def test_set_parent_router_bad_type(self):
router = Router()
with pytest.raises(ValueError, match=r"router should be instance of Router"):
router.parent_router = object()
def test_observers_config(self):
router = Router()
assert router.update_handler.handlers