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