mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 02:03:04 +00:00
* #896 Restrict including routers with strings * Remove imports util, bump dependencies
This commit is contained in:
parent
4fb77a3a2a
commit
f2e02e2a7c
7 changed files with 11 additions and 70 deletions
|
|
@ -5,7 +5,6 @@ from aiogram.dispatcher.router import Router
|
|||
from aiogram.utils.warnings import CodeHasNoEffect
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
importable_router = Router()
|
||||
|
||||
|
||||
class TestRouter:
|
||||
|
|
@ -46,14 +45,10 @@ class TestRouter:
|
|||
with pytest.warns(CodeHasNoEffect):
|
||||
assert router1.include_router(router2)
|
||||
|
||||
def test_include_router_by_string(self):
|
||||
router = Router()
|
||||
router.include_router("tests.test_dispatcher.test_router:importable_router")
|
||||
|
||||
def test_include_router_by_string_bad_type(self):
|
||||
router = Router()
|
||||
with pytest.raises(ValueError, match=r"router should be instance of Router"):
|
||||
router.include_router("tests.test_dispatcher.test_router:TestRouter")
|
||||
router.include_router(self)
|
||||
|
||||
def test_set_parent_router_bad_type(self):
|
||||
router = Router()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue