[Appointments] Test Setup (Mock) #186

Closed
opened 2026-01-19 20:44:15 +00:00 by duarteneves5 · 0 comments
duarteneves5 commented 2026-01-19 20:44:15 +00:00 (Migrated from github.com)

Create tests/test_routes/test_appointments.py.
Configure AsyncMock for AppointmentRepo.

Test Create:

  • test_create_appointment_success (201 Created).
  • test_create_appointment_client_not_found (Mock repo raising HTTPException(404), expect 404).

Test Read:

  • test_get_appointment_by_id_success (200 OK).
  • test_get_appointment_by_id_not_found (Mock repo returning None, expect 404).
  • test_get_all_appointments (200 OK - Note: Your repo currently doesn't have a get_all, so maybe skip or implement get_appointments_by_client_id).

Test Read (Filters):

  • test_get_appointments_by_client (Mock repo.get_appointments_by_client_id, expect 200).
  • test_get_appointments_by_vehicle (Mock repo.get_appointments_by_vehicle_id, expect 200).

Test Update:

  • test_update_appointment_success (200 OK).
  • test_update_appointment_not_found (Expect 404).

Test Delete:

  • test_delete_appointment_success (204 No Content).
  • test_delete_appointment_not_found (Expect 404).
Create `tests/test_routes/test_appointments.py`. Configure `AsyncMock` for `AppointmentRepo`. **Test Create:** - `test_create_appointment_success` (201 Created). - `test_create_appointment_client_not_found` (Mock repo raising `HTTPException(404)`, expect 404). **Test Read:** - `test_get_appointment_by_id_success` (200 OK). - `test_get_appointment_by_id_not_found` (Mock repo returning `None`, expect 404). - `test_get_all_appointments` (200 OK - Note: Your repo currently doesn't have a `get_all`, so maybe skip or implement `get_appointments_by_client_id`). **Test Read (Filters):** - `test_get_appointments_by_client` (Mock `repo.get_appointments_by_client_id`, expect 200). - `test_get_appointments_by_vehicle` (Mock `repo.get_appointments_by_vehicle_id`, expect 200). **Test Update:** - `test_update_appointment_success` (200 OK). - `test_update_appointment_not_found` (Expect 404). **Test Delete:** - `test_delete_appointment_success` (204 No Content). - `test_delete_appointment_not_found` (Expect 404).
Sign in to join this conversation.
No description provided.