halfapi/tests/test_lib_domain.py

19 lines
639 B
Python
Raw Normal View History

#!/usr/bin/env python3
import importlib
2021-05-28 22:30:48 +02:00
from halfapi.lib.domain import VERBS, gen_router_routes
def test_gen_router_routes():
from .dummy_domain import routers
for path, d_route in gen_router_routes(routers, ['dummy_domain']):
assert isinstance(path, str)
for verb in VERBS:
if verb not in d_route.keys():
continue
route = d_route[verb]
print(f'[{verb}] {path} {route["fct"]}')
assert len(route['params']) > 0
assert hasattr(route['fct'], '__call__')
if 'fqtn' in route:
assert isinstance(route['fqtn'], str)