Skip to content

Commit 0d36200

Browse files
committed
Added test cases for additional error codes
1 parent ea39091 commit 0d36200

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backend/tests/controller/test_fhir_api_exception_handler.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
from controller.fhir_api_exception_handler import fhir_api_exception_handler
66
from models.errors import (
77
CustomValidationError,
8+
IdentifierDuplicationError,
89
InvalidJsonError,
910
ResourceNotFoundError,
1011
UnauthorizedError,
1112
UnauthorizedVaxError,
13+
UnhandledResponseError,
1214
)
1315

1416

@@ -48,6 +50,18 @@ def test_exception_handler_handles_custom_exception_and_returns_fhir_response(se
4850
"not-found",
4951
"Immunization resource does not exist. ID: 123",
5052
),
53+
(
54+
IdentifierDuplicationError("system#id"),
55+
422,
56+
"duplicate",
57+
"The provided identifier: system#id is duplicated",
58+
),
59+
(
60+
UnhandledResponseError(message="Critical error", response={"outcome": "critical error"}),
61+
500,
62+
"exception",
63+
"Critical error\n{'outcome': 'critical error'}",
64+
),
5165
]
5266

5367
for error, expected_status, expected_code, expected_message in test_cases:

0 commit comments

Comments
 (0)