예제 #1
0
def test_override_basePath(loop):
    router = SwaggerRouter(search_dirs=['tests'])
    web.Application(router=router, loop=loop)
    prefix = '/override'
    router.include('data/root.yaml', basePath=prefix)
    paths = [url for url in [
        route.url_for().human_repr()
        for route in router.routes()
    ] if url.startswith(prefix)]
    assert prefix in router._swagger_data
    assert paths
예제 #2
0
def test_route_include(swagger_router: SwaggerRouter):
    paths = [route.url_for().human_repr()
             for route in swagger_router.routes()]
    assert '/api/1/include2/inc/image' in paths, paths
예제 #3
0
def test_handler(swagger_router: SwaggerRouter):
    paths = [(route.method, route.url_for().human_repr())
             for route in swagger_router.routes()]
    assert ('GET', '/api/1/include/image') in paths
예제 #4
0
def test_routes(swagger_router: SwaggerRouter):
    paths = [route.url_for().human_repr()
             for route in swagger_router.routes()]
    assert '/api/1/file/image' in paths