mirror of https://github.com/tiangolo/fastapi.git
Add test for successful item creation in test_json_error_improvements.py
This commit is contained in:
parent
7a8da3a4ad
commit
dc1321b0d0
|
|
@ -139,3 +139,16 @@ def test_json_decode_error_in_middle_of_long_document():
|
|||
assert error["input"].endswith("...")
|
||||
assert "invalid" in error["input"]
|
||||
assert error["type"] == "json_invalid"
|
||||
|
||||
|
||||
def test_successful_item_creation():
|
||||
response = client.post(
|
||||
"/items/",
|
||||
json={"name": "Test Item", "price": 19.99, "description": "A test item"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["name"] == "Test Item"
|
||||
assert data["price"] == 19.99
|
||||
assert data["description"] == "A test item"
|
||||
|
|
|
|||
Loading…
Reference in New Issue