thousandeyes-sdk-python/thousandeyes-sdk-core/test/test_exceptions.py
Kevin Han 75929e93d0
Some checks failed
Python CI / build (push) Has been cancelled
Feat: Add core integration test mock server support (#165)
* 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>

* add test for validating OAS not match case

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-30 15:41:13 +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