[Clients] Test Setup (Mock) #174

Closed
opened 2025-12-12 17:22:17 +00:00 by GFMpt13 · 0 comments
GFMpt13 commented 2025-12-12 17:22:17 +00:00 (Migrated from github.com)
  • Create tests/test_routes/test_clients.py.

  • Configure AsyncMock for ClientRepo.

  • Test Create:

    • test_create_client_success (201 Created).
    • test_create_client_duplicate_nif (Mock repo raising DuplicateClientNIFError, expect 409).
  • Test Read:

    • test_get_client_by_id_success (200 OK).
    • test_get_client_by_id_not_found (Mock repo raising ClientNotFoundError, expect 404).
    • test_get_all_clients (200 OK).
  • Test Read (Filters):

    • test_get_client_by_nif_success (Mock repo.get_by_nif, expect 200).
    • test_get_client_by_email_success (Mock repo.get_by_email, expect 200).
    • test_get_client_by_nif_not_found (Expect 404).
  • Test Update:

    • test_update_client_success (200 OK).
    • test_update_client_not_found (404 Not Found).
  • Test Delete:

    • test_delete_client_success (204 No Content or 200 OK).
- [x] Create tests/test_routes/test_clients.py. - [x] Configure AsyncMock for ClientRepo. - [x] Test Create: - [x] test_create_client_success (201 Created). - [x] test_create_client_duplicate_nif (Mock repo raising DuplicateClientNIFError, expect 409). - [x] Test Read: - [x] test_get_client_by_id_success (200 OK). - [x] test_get_client_by_id_not_found (Mock repo raising ClientNotFoundError, expect 404). - [x] test_get_all_clients (200 OK). - [x] Test Read (Filters): - [x] test_get_client_by_nif_success (Mock repo.get_by_nif, expect 200). - [x] test_get_client_by_email_success (Mock repo.get_by_email, expect 200). - [x] test_get_client_by_nif_not_found (Expect 404). - [x] Test Update: - [x] test_update_client_success (200 OK). - [x] test_update_client_not_found (404 Not Found). - [x] Test Delete: - [x] test_delete_client_success (204 No Content or 200 OK).
Sign in to join this conversation.
No description provided.