Browse Source
Add test for successful item creation in test_json_error_improvements.py
pull/14089/head
Arif Dogan
9 months ago
No known key found for this signature in database
GPG Key ID: A2131177E83422CE
1 changed files with
13 additions and
0 deletions
-
tests/test_json_error_improvements.py
|
|
|
@ -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" |
|
|
|
|