Analysis of the bnc-cpt-api test suite reveals several areas of duplication, particularly in the payment service tests. Many tests are repeated across multiple files at both the service layer and the endpoint layer without clear separation of concerns.
tests/test_payment.py and tests/test_payment_service.py._validate_payment_id: Tested in both files._mark_session_paid_if_linked: Tested in both files.verify_payment: Tested in both files._ensure_receipt_pdf: Tested in both files.tests/test_payment_service.py. Remove the TestPaymentServiceUnit class and related methods from tests/test_payment.py.tests/test_auth.py and tests/test_auth_service.py.test_auth.py does it via HTTP, while test_auth_service.py does it via service calls.test_auth.py focused on HTTP status codes and response structures. Ensure test_auth_service.py handles all edge cases for the logic itself.test_tesla.py, test_tesla_router.py, test_tesla_fleet_service.py, test_tesla_fleet_helpers.py, test_tesla_normalization.py, test_tesla_provider_auth.py, test_tesla_provider_client.py.test_tesla.py (HTTP + Logic), test_tesla_router.py (HTTP), and test_tesla_fleet_service.py (Logic).get_vehicles, select_vehicles, and mark_session_paid are tested redundantly across test_tesla.py, test_tesla_router.py, and test_tesla_fleet_service.py._car_type_to_model and _vin_to_year are tested in both test_tesla.py and test_tesla_fleet_helpers.py.test_tesla.py and test_tesla_normalization.py.test_tesla.py: This file has become a "catch-all" that duplicates specialized files. Its contents should be moved to the specialized files and then deleted.test_tesla_fleet_helpers.py.test_tesla_router.py only tests HTTP-related concerns (status codes, JSON serialization) and mocks the service layer entirely. All business logic and Redis state transitions should live in test_tesla_fleet_service.py.TestPaymentServiceUnit from test_payment.py to test_payment_service.py if anything is missing there, then delete it from test_payment.py.test_auth.py and ensure they are covered in test_auth_service.py.test_tesla_api.py: Router/Endpoint tests.test_tesla_service.py: Business logic and orchestration.test_tesla_provider.py: Low-level provider/client tests (Tesla Fleet API specifics).mock_redis, mock_stripe, mock_tesla) to a central conftest.py to reduce boilerplate duplication in before blocks.