thousandeyes-sdk-python/thousandeyes-sdk-core/test/test_exceptions.py
Kevin 509c351f85 CP-2453 Add core test mock server and exception status mapping
Move the integration mock server into test-only sdk_test_support helpers
and expose ApiException.exception_class_for_http_status for generated
integration error assertions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 15:34:11 +01:00

29 lines
719 B
Python

import pytest
from thousandeyes_sdk.core.exceptions import (
ApiException,
BadRequestException,
ForbiddenException,
NotFoundException,
ServiceException,
TooManyRequestsException,
UnauthorizedException,
)
@pytest.mark.parametrize(
("status", "expected"),
[
(400, BadRequestException),
(401, UnauthorizedException),
(403, ForbiddenException),
(404, NotFoundException),
(429, TooManyRequestsException),
(500, ServiceException),
(503, ServiceException),
(418, ApiException),
],
)
def test_exception_class_for_http_status(status, expected):
assert ApiException.exception_class_for_http_status(status) is expected