[Vehicles] - Write Failing DB Tests for CRUD Operations #103

Closed
opened 2025-11-03 17:45:36 +00:00 by GFMpt13 · 0 comments
GFMpt13 commented 2025-11-03 17:45:36 +00:00 (Migrated from github.com)

Following TDD, write tests before implementation. These tests will fail, as the interface methods are empty.

Tasks:

  • Set up the pytest file (e.g., tests/test_vehicle_repo.py).
  • Create database fixtures (e.g., a test database, a sample client fixture, a sample vehicle fixture).
  • Write a test for test_create_vehicle_success.
  • Write a test for test_create_vehicle_duplicate_license_plate_fails (to test the unique index).
  • Write a test for test_get_vehicle_by_id_success.
  • Write a test for test_get_vehicle_by_id_not_found.
  • Write a test for test_get_vehicle_by_license_plate_success.
  • Write a test for test_get_vehicles_by_client_id_returns_list.
  • Write a test for test_update_vehicle_success (e.g., updating kilometers).
  • Write a test for test_delete_vehicle_success.
  • Run pytest and confirm all new tests fail as expected.
Following TDD, write tests *before* implementation. These tests will fail, as the interface methods are empty. **Tasks:** - [x] Set up the `pytest` file (e.g., `tests/test_vehicle_repo.py`). - [x] Create database fixtures (e.g., a test database, a sample `client` fixture, a sample `vehicle` fixture). - [x] Write a test for `test_create_vehicle_success`. - [x] Write a test for `test_create_vehicle_duplicate_license_plate_fails` (to test the unique index). - [x] Write a test for `test_get_vehicle_by_id_success`. - [x] Write a test for `test_get_vehicle_by_id_not_found`. - [x] Write a test for `test_get_vehicle_by_license_plate_success`. - [x] Write a test for `test_get_vehicles_by_client_id_returns_list`. - [x] Write a test for `test_update_vehicle_success` (e.g., updating `kilometers`). - [x] Write a test for `test_delete_vehicle_success`. - [x] Run `pytest` and confirm all new tests fail as expected.
Sign in to join this conversation.
No description provided.