Skip to content

Add comprehensive unit tests for exception handling - #10

Open
GregoryMonzon wants to merge 17 commits into
dillonhuston:contributionfrom
gmonzon05:feature/exception-handling-unit-tests
Open

Add comprehensive unit tests for exception handling#10
GregoryMonzon wants to merge 17 commits into
dillonhuston:contributionfrom
gmonzon05:feature/exception-handling-unit-tests

Conversation

@GregoryMonzon

Copy link
Copy Markdown
Contributor

Closes #6

Adds 22 unit tests covering the ServiceError exception hierarchy and both exception handlers registered in main.py.

Test coverage:
-ServiceError base class — default status code, default message, custom detail and status code
-All 7 subclasses — correct HTTP status codes and default detail messages
-Response structure — JSON content type and {"detail": "..."} shape
-Unhandled exception fallback — 500 status and JSON response

Tests use a minimal in-process FastAPI app with TestClient — no database or external infrastructure required. All 22 tests pass.

@GregoryMonzon
GregoryMonzon marked this pull request as draft July 31, 2026 03:32
@GregoryMonzon
GregoryMonzon marked this pull request as ready for review July 31, 2026 03:33
@GregoryMonzon
GregoryMonzon changed the base branch from main to contribution July 31, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Comprehensive Unit Testing for Exception Handling:

3 participants