Skip to content

Commit

Permalink
test(api): local import get_openapi to avoid breaking all tests if …
Browse files Browse the repository at this point in the history
…FastAPI changes its API
  • Loading branch information
laurent-laporte-pro committed Apr 19, 2024
1 parent 8a176f4 commit 532a7ea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/integration/test_apidoc.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from fastapi.openapi.utils import get_flat_models_from_routes
from fastapi.utils import get_model_definitions
from pydantic.schema import get_model_name_map
from starlette.testclient import TestClient
from antarest import __version__


def test_apidoc(client: TestClient) -> None:
# Asserts that the apidoc can be loaded
flat_models = get_flat_models_from_routes(client.app.routes)
model_name_map = get_model_name_map(flat_models)
get_model_definitions(flat_models=flat_models, model_name_map=model_name_map)
# Local import to avoid breaking all tests if FastAPI changes its API
from fastapi.openapi.utils import get_openapi

routes = client.app.routes
openapi = get_openapi(title="Antares Web", version=__version__, routes=routes)
assert openapi

0 comments on commit 532a7ea

Please sign in to comment.