Coverage for tests/test_tutorial/test_additional_status_codes/test_tutorial001.py: 100%

11 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.additional_status_codes.tutorial001 import app 1abcde

4 

5client = TestClient(app) 1abcde

6 

7 

8def test_update(): 1abcde

9 response = client.put("/items/foo", json={"name": "Wrestlers"}) 1abcde

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

11 assert response.json() == {"name": "Wrestlers", "size": None} 1abcde

12 

13 

14def test_create(): 1abcde

15 response = client.put("/items/red", json={"name": "Chillies"}) 1abcde

16 assert response.status_code == 201, response.text 1abcde

17 assert response.json() == {"name": "Chillies", "size": None} 1abcde