From c603727190e44f99ec6b0cde1bb724826a03a82b Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Sun, 4 Oct 2020 17:26:36 +0200 Subject: [PATCH] [test] adjust test_gen_router_routes to fit the new behaviour --- tests/test_lib_domain.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/test_lib_domain.py b/tests/test_lib_domain.py index 1b5308a..e54fbe2 100644 --- a/tests/test_lib_domain.py +++ b/tests/test_lib_domain.py @@ -6,12 +6,17 @@ from halfapi.lib.routes import gen_starlette_routes def test_gen_router_routes(): from .dummy_domain import routers - for route in gen_router_routes(routers): - print(f'[{route["verb"]}] {route["path"]} {route["fct"]}') - assert route['verb'] in VERBS - assert isinstance(route['path'], str) - assert len(route['params']) > 0 - assert hasattr(route['fct'], '__call__') + for path, d_route in gen_router_routes(routers): + 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 hasattr('fqtn', route): + assert isinstance(route['fqtn'], str) def test_gen_starlette_routes():