Coverage for tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from fastapi.testclient import TestClient 1abcde

2 

3from docs_src.path_operation_advanced_configuration.tutorial005 import app 1abcde

4 

5client = TestClient(app) 1abcde

6 

7 

8def test_get(): 1abcde

9 response = client.get("/items/") 1abcde

10 assert response.status_code == 200, response.text 1abcde

11 

12 

13def test_openapi_schema(): 1abcde

14 response = client.get("/openapi.json") 1abcde

15 assert response.status_code == 200, response.text 1abcde

16 assert response.json() == { 1abcde

17 "openapi": "3.1.0", 

18 "info": {"title": "FastAPI", "version": "0.1.0"}, 

19 "paths": { 

20 "/items/": { 

21 "get": { 

22 "responses": { 

23 "200": { 

24 "description": "Successful Response", 

25 "content": {"application/json": {"schema": {}}}, 

26 } 

27 }, 

28 "summary": "Read Items", 

29 "operationId": "read_items_items__get", 

30 "x-aperture-labs-portal": "blue", 

31 } 

32 } 

33 }, 

34 }