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

11 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1from fastapi.testclient import TestClient 1abcd

2from inline_snapshot import snapshot 1abcd

3 

4from docs_src.path_operation_advanced_configuration.tutorial005_py310 import app 1abcd

5 

6client = TestClient(app) 1abcd

7 

8 

9def test_get(): 1abcd

10 response = client.get("/items/") 1hij

11 assert response.status_code == 200, response.text 1hij

12 

13 

14def test_openapi_schema(): 1abcd

15 response = client.get("/openapi.json") 1efg

16 assert response.status_code == 200, response.text 1efg

17 assert response.json() == snapshot( 1efg

18 { 

19 "openapi": "3.1.0", 

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

21 "paths": { 

22 "/items/": { 

23 "get": { 

24 "responses": { 

25 "200": { 

26 "description": "Successful Response", 

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

28 } 

29 }, 

30 "summary": "Read Items", 

31 "operationId": "read_items_items__get", 

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

33 } 

34 } 

35 }, 

36 } 

37 )