test: select an available vehicle for booking creation
This commit is contained in:
@@ -32,17 +32,22 @@ def test_create_booking_rejects_overlap_and_audits_valid_booking(ops_client):
|
||||
},
|
||||
)
|
||||
assert conflict.status_code == 409
|
||||
available_vehicle = ops_client.get(
|
||||
"/api/v1/vehicles", params={"status": "available"}
|
||||
).json()[0]["public_ref"]
|
||||
created = ops_client.post(
|
||||
"/api/v1/bookings",
|
||||
json={
|
||||
"customer_ref": "CUS-0001", "vehicle_ref": "MO-001",
|
||||
"starts_at": "2030-09-01T10:00:00Z", "ends_at": "2030-09-02T12:00:00Z",
|
||||
"customer_ref": "CUS-0001",
|
||||
"vehicle_ref": available_vehicle,
|
||||
"starts_at": "2030-09-01T10:00:00Z",
|
||||
"ends_at": "2030-09-02T12:00:00Z",
|
||||
},
|
||||
)
|
||||
assert created.status_code == 201
|
||||
body = created.json()
|
||||
assert body["status"] == "reserved"
|
||||
assert body["vehicle_ref"] == "MO-001"
|
||||
assert body["vehicle_ref"] == available_vehicle
|
||||
|
||||
|
||||
def test_get_booking_detail(ops_client):
|
||||
|
||||
Reference in New Issue
Block a user