Fixing test update spool issue
This commit is contained in:
@@ -104,19 +104,28 @@ def test_update_spool_price(random_filament: dict[str, Any]):
|
|||||||
# Setup
|
# Setup
|
||||||
result = httpx.post(
|
result = httpx.post(
|
||||||
f"{URL}/api/v1/spool",
|
f"{URL}/api/v1/spool",
|
||||||
json={"filament_id": random_filament["id"]},
|
json={
|
||||||
|
"filament_id": random_filament["id"],
|
||||||
|
"price": 50,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
result.raise_for_status()
|
result.raise_for_status()
|
||||||
spool = result.json()
|
spool = result.json()
|
||||||
|
|
||||||
# Execute
|
# Execute
|
||||||
|
price = 25
|
||||||
|
last_used = "2023-01-02T12:00:00+02:00"
|
||||||
result = httpx.patch(
|
result = httpx.patch(
|
||||||
f"{URL}/api/v1/spool/{spool['id']}",
|
f"{URL}/api/v1/spool/{spool['id']}",
|
||||||
json={
|
json={
|
||||||
"price": 750,
|
"price": price,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
assert result.status_code == 400 # Cannot update both used and remaining weight
|
result.raise_for_status()
|
||||||
|
|
||||||
|
# Verify
|
||||||
|
spool = result.json()
|
||||||
|
assert spool["price"] == 25
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
httpx.delete(f"{URL}/api/v1/spool/{spool['id']}").raise_for_status()
|
httpx.delete(f"{URL}/api/v1/spool/{spool['id']}").raise_for_status()
|
||||||
|
|||||||
Reference in New Issue
Block a user