halfapi/tests/test_lib_routes.py

35 lines
1.1 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# from starlette.routing import Route
# from halfapi.lib.routes import gen_starlette_routes, gen_router_routes
# 
# def test_gen_starlette_routes():
#  from .dummy_domain import routers
#  for route in gen_starlette_routes({
#  'dummy_domain': routers }):
# 
#  assert isinstance(route, Route)
# 
# import pytest
# 
# @pytest.mark.skip
# def test_api_routes():
#  from . import dummy_domain
#  d_res, d_acls = api_routes(dummy_domain)
#  assert isinstance(d_res, dict)
#  assert isinstance(d_acls, dict)
# 
#  yielded = False
# 
#  for path, verb, m_router, fct, params in gen_router_routes(dummy_domain, []):
#  if not yielded:
#  yielded = True
# 
#  assert path in d_res
#  assert verb in d_res[path]
#  assert 'docs' in d_res[path][verb]
#  assert 'acls' in d_res[path][verb]
#  assert isinstance(d_res[path][verb]['docs'], dict)
#  assert isinstance(d_res[path][verb]['acls'], list)
#  assert len(d_res[path][verb]['acls']) == len(params)
# 
#  assert yielded is True