2020-09-22 12:57:36 +02:00
|
|
|
#!/usr/bin/env python3
|
2020-10-07 09:52:23 +02:00
|
|
|
import importlib
|
2021-05-28 22:30:48 +02:00
|
|
|
from halfapi.lib.domain import VERBS, gen_router_routes
|
2020-09-22 12:57:36 +02:00
|
|
|
|
2020-09-25 01:06:21 +02:00
|
|
|
|
|
|
|
def test_gen_router_routes():
|
2020-09-22 12:57:36 +02:00
|
|
|
from .dummy_domain import routers
|
2020-10-07 09:52:23 +02:00
|
|
|
for path, d_route in gen_router_routes(routers, ['dummy_domain']):
|
2020-10-04 17:26:36 +02:00
|
|
|
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__')
|
2020-10-07 09:52:23 +02:00
|
|
|
if 'fqtn' in route:
|
2020-10-04 17:26:36 +02:00
|
|
|
assert isinstance(route['fqtn'], str)
|