M36: deepen operational and mobile UX
This commit is contained in:
@@ -150,6 +150,35 @@ def test_reserved_booking_can_be_cancelled_once(ops_client):
|
||||
assert repeated.status_code == 409
|
||||
|
||||
|
||||
def test_reserved_booking_can_be_rescheduled_with_overlap_protection(ops_client):
|
||||
window = {"starts_at": "2033-09-01T10:00:00Z", "ends_at": "2033-09-02T12:00:00Z"}
|
||||
existing = ops_client.get("/api/v1/bookings/BK-DEMO-RETURN").json()
|
||||
booking = ops_client.post(
|
||||
"/api/v1/bookings",
|
||||
json={"customer_ref": "CUS-0001", "vehicle_ref": existing["vehicle_ref"], **window},
|
||||
).json()
|
||||
updated = ops_client.patch(
|
||||
f"/api/v1/bookings/{booking['public_ref']}/schedule",
|
||||
json={
|
||||
"starts_at": "2033-09-03T10:00:00Z",
|
||||
"ends_at": "2033-09-04T12:00:00Z",
|
||||
"reason": "Customer requested a later collection",
|
||||
},
|
||||
)
|
||||
assert updated.status_code == 200
|
||||
assert updated.json()["starts_at"].startswith("2033-09-03T10:00:00")
|
||||
|
||||
conflict = ops_client.patch(
|
||||
f"/api/v1/bookings/{booking['public_ref']}/schedule",
|
||||
json={
|
||||
"starts_at": existing["starts_at"],
|
||||
"ends_at": existing["ends_at"],
|
||||
"reason": "Conflicting test move",
|
||||
},
|
||||
)
|
||||
assert conflict.status_code == 409
|
||||
|
||||
|
||||
def test_concurrent_bookings_only_reserve_vehicle_once():
|
||||
results: list[int] = []
|
||||
seed_client = TestClient(app)
|
||||
|
||||
Reference in New Issue
Block a user