mirror of https://github.com/tiangolo/fastapi.git
Fix tutorial005_py310: make 'description' required and update tests accordingly
This commit is contained in:
parent
6c0d4110ae
commit
2682f7d21d
|
|
@ -17,12 +17,11 @@ def get_client(request: pytest.FixtureRequest):
|
|||
|
||||
|
||||
def test_required_nullable_field(client: TestClient):
|
||||
response = client.post("/items/", json={"description": None})
|
||||
response = client.post("/items/", json={"description": "Some description"})
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"description": None}
|
||||
assert response.json() == {"description": "Some description"}
|
||||
|
||||
|
||||
def test_required_field_missing(client: TestClient):
|
||||
response = client.post("/items/", json={})
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"description": None}
|
||||
assert response.status_code == 422
|
||||
|
|
|
|||
Loading…
Reference in New Issue