Coverage for tests/test_tutorial/test_additional_status_codes/test_tutorial001_an_py310.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
1import pytest 1deabc
2from fastapi.testclient import TestClient 1deabc
4from ...utils import needs_py310 1deabc
7@pytest.fixture(name="client") 1deabc
8def get_client(): 1deabc
9 from docs_src.additional_status_codes.tutorial001_an_py310 import app 1abc
11 client = TestClient(app) 1abc
12 return client 1abc
15@needs_py310 1deabc
16def test_update(client: TestClient): 1deabc
17 response = client.put("/items/foo", json={"name": "Wrestlers"}) 1abc
18 assert response.status_code == 200, response.text 1abc
19 assert response.json() == {"name": "Wrestlers", "size": None} 1abc
22@needs_py310 1deabc
23def test_create(client: TestClient): 1deabc
24 response = client.put("/items/red", json={"name": "Chillies"}) 1abc
25 assert response.status_code == 201, response.text 1abc
26 assert response.json() == {"name": "Chillies", "size": None} 1abc