mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2026-08-04 00:46:52 +00:00
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>
29 lines
719 B
Python
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
|