[Vehicles] Test Setup (Mock) #194

Closed
opened 2026-01-19 22:51:09 +00:00 by duarteneves5 · 1 comment
duarteneves5 commented 2026-01-19 22:51:09 +00:00 (Migrated from github.com)

Create tests/test_routes/test_vehicles.py.
Configure AsyncMock for VehicleRepo.

Test Create:

  • test_create_vehicle_success (201 Created).
  • test_create_vehicle_duplicate (Mock repo raising DuplicateVehicleError, expect 409).

Test Read:

  • test_get_vehicle_by_id_success (200 OK).
  • test_get_vehicle_by_id_not_found (Expect 404).

Test Read (Filters):

  • test_get_vehicle_by_license_plate (Mock repo.get_by_license_plate, expect 200).
  • test_get_vehicles_by_client (Mock repo.get_by_client_id, expect 200).

Test Update:

  • test_update_vehicle_km_success (200 OK - Updates kilometers).
  • test_update_vehicle_not_found (Expect 404).

Test Delete:

  • test_delete_vehicle_success (204 No Content).
Create `tests/test_routes/test_vehicles.py`. Configure `AsyncMock` for `VehicleRepo`. **Test Create:** - `test_create_vehicle_success` (201 Created). - `test_create_vehicle_duplicate` (Mock repo raising `DuplicateVehicleError`, expect 409). **Test Read:** - `test_get_vehicle_by_id_success` (200 OK). - `test_get_vehicle_by_id_not_found` (Expect 404). **Test Read (Filters):** - `test_get_vehicle_by_license_plate` (Mock `repo.get_by_license_plate`, expect 200). - `test_get_vehicles_by_client` (Mock `repo.get_by_client_id`, expect 200). **Test Update:** - `test_update_vehicle_km_success` (200 OK - Updates kilometers). - `test_update_vehicle_not_found` (Expect 404). **Test Delete:** - `test_delete_vehicle_success` (204 No Content).
AndreFerreira5 commented 2026-01-22 23:18:20 +00:00 (Migrated from github.com)

this issue has already been integrated in the maion branch, closing...

this issue has already been integrated in the maion branch, closing...
Sign in to join this conversation.
No description provided.