Coverage for tests / test_swagger_ui_init_oauth.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-02-12 18:15 +0000
1from fastapi import FastAPI 1abcd
2from fastapi.testclient import TestClient 1abcd
4swagger_ui_init_oauth = {"clientId": "the-foo-clients", "appName": "The Predendapp"} 1abcd
6app = FastAPI(swagger_ui_init_oauth=swagger_ui_init_oauth) 1abcd
9@app.get("/items/") 1abcd
10async def read_items(): 1abcd
11 return {"id": "foo"} 1hij
14client = TestClient(app) 1abcd
17def test_swagger_ui(): 1abcd
18 response = client.get("/docs") 1efg
19 assert response.status_code == 200, response.text 1efg
20 print(response.text) 1efg
21 assert "ui.initOAuth" in response.text 1efg
22 assert '"appName": "The Predendapp"' in response.text 1efg
23 assert '"clientId": "the-foo-clients"' in response.text 1efg
26def test_response(): 1abcd
27 response = client.get("/items/") 1hij
28 assert response.json() == {"id": "foo"} 1hij