[WorkOrders] - Write Failing DB Tests for CRUD Operations #112
Labels
No labels
CI/CD
MongoDB
PostgreSQL
api
authentication
bug
documentation
duplicate
enhancement
example issue
fix
good first issue
help wanted
high-level requirement
infrastructure
invalid
low-level requirement
medium-level requirement
question
security
test
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
AndreFerreira5/starranja#112
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Following TDD, write tests before implementation. These tests will fail, as the interface methods are empty.
Tasks:
pytestfile (e.g.,tests/test_workOrder_repo.py).clientfixture, a sampleworkOrderfixture).test_create_workOrder_success.test_get_workOrder_by_id_success.test_get_workOrder_by_id_not_found.test_get_workOrders_by_vehicle_id_returns_list.test_get_workOrders_by_client_id_returns_list.test_get_by_work_order_number.test_get_active_by_vehicle_id.test_create_work_order_fails_on_active_vehicle.test_update_workOrder_success(e.g., updatingitems).test_delete_workOrder_success.pytestand confirm all new tests fail as expected.I have removed test_get_workOrders_by_appointment_id_returns_list. That logic cannot exist in the WorkOrderRepo because the WorkOrder model does not have an appointment_id. That test belongs in Route/Service test file, where we can mock both the AppointmentRepo and WorkOrderRepo.
I have added tests for get_by_work_order_number and get_active_by_vehicle_id, as these are critical methods defined in the interface. I also added a test for the most important business rule, test_create_work_order_fails_on_active_vehicle (RB02).