Improve passport layout and deletion flows
Some checks failed
ci / test (push) Has been cancelled

This commit is contained in:
VPN SaaS Dev
2026-05-16 11:38:29 +09:00
parent 8aa6640308
commit 01a69fc42d
8 changed files with 347 additions and 38 deletions

View File

@@ -203,6 +203,75 @@ async def test_customer_booking_lifecycle_capacity_calendar_work_order_and_notif
my_appointments = await client.get("/api/appointments/my", headers=other_auth_headers)
assert my_appointments.json()[0]["linked_work_order_id"] == work_order.json()["id"]
owner_delete_converted = await client.delete(f"/api/appointments/{appointment['id']}", headers=other_auth_headers)
sto_delete_converted = await client.delete(f"/api/sto/appointments/{appointment['id']}", headers=auth_headers)
assert owner_delete_converted.status_code == 409
assert sto_delete_converted.status_code == 409
@pytest.mark.asyncio
async def test_appointments_can_be_deleted_by_owner_or_sto_before_work_order(
client, auth_headers, other_auth_headers, admin_auth_headers, internal_headers
) -> None:
center = await create_verified_center(client, auth_headers, admin_auth_headers, internal_headers, city="Delete Booking")
workday = next_weekday(2)
await client.post(
"/api/sto/settings/booking",
headers=auth_headers,
json={
"service_center_id": center["id"],
"working_days": [0, 1, 2, 3, 4],
"open_time": "09:00:00",
"close_time": "18:00:00",
"slot_duration_minutes": 60,
"max_parallel_bookings": 1,
"accepts_online_booking": True,
},
)
vehicle = (
await client.post(
"/api/my/vehicles",
headers=other_auth_headers,
json={"name": "Delete booking car", "current_odometer": 12000},
)
).json()
owner_deleted = (
await client.post(
"/api/appointments",
headers=other_auth_headers,
json={
"service_center_id": center["id"],
"vehicle_id": vehicle["id"],
"service_type": "diagnostics",
"service_name": "Diagnostics",
"requested_start_at": datetime.combine(workday, time(10, 0), tzinfo=UTC).isoformat(),
"estimated_duration_minutes": 60,
},
)
).json()
deleted_by_owner = await client.delete(f"/api/appointments/{owner_deleted['id']}", headers=other_auth_headers)
assert deleted_by_owner.status_code == 204
sto_deleted = (
await client.post(
"/api/appointments",
headers=other_auth_headers,
json={
"service_center_id": center["id"],
"vehicle_id": vehicle["id"],
"service_type": "diagnostics",
"service_name": "Diagnostics",
"requested_start_at": datetime.combine(workday, time(11, 0), tzinfo=UTC).isoformat(),
"estimated_duration_minutes": 60,
},
)
).json()
deleted_by_sto = await client.delete(f"/api/sto/appointments/{sto_deleted['id']}", headers=auth_headers)
assert deleted_by_sto.status_code == 204
my_appointments = await client.get("/api/appointments/my", headers=other_auth_headers)
assert {item["id"] for item in my_appointments.json()}.isdisjoint({owner_deleted["id"], sto_deleted["id"]})
@pytest.mark.asyncio