mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2026-08-05 01:06:51 +00:00
CP-2453 Add generated integration tests for all SDK packages
Sync OAS-driven integration test artifacts (mock manifest, test base, conftest, and per-operation integration tests) across 21 packages for CP-2453 full rollout evaluation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
509c351f85
commit
5441f44f1f
7
thousandeyes-sdk-administrative/test/conftest.py
Normal file
7
thousandeyes-sdk-administrative/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Administrative API
|
||||||
|
|
||||||
|
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
3252
thousandeyes-sdk-administrative/test/mock_manifest.py
Normal file
3252
thousandeyes-sdk-administrative/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,219 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Administrative API
|
||||||
|
|
||||||
|
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.administrative.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.administrative.api.permissions_api import PermissionsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestPermissionsApiIntegration(IntegrationTestBase):
|
||||||
|
"""PermissionsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = PermissionsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_permissions success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"permissions" : [ {
|
||||||
|
"label" : "View reports",
|
||||||
|
"permissionId" : "1",
|
||||||
|
"isManagementPermission" : true,
|
||||||
|
"permission" : "REPORT_READ"
|
||||||
|
}, {
|
||||||
|
"label" : "View snapshots",
|
||||||
|
"permissionId" : "51",
|
||||||
|
"isManagementPermission" : false,
|
||||||
|
"permission" : "REPORT_SNAPSHOTS_READ"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_400(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 400)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_401(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_403(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_404(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_429(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_permissions_error_500(self) -> None:
|
||||||
|
"""Integration test for get_permissions error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_permissions(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_permissions", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
1119
thousandeyes-sdk-administrative/test/test_roles_api_integration.py
Normal file
1119
thousandeyes-sdk-administrative/test/test_roles_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,324 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Administrative API
|
||||||
|
|
||||||
|
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.administrative.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.administrative.api.user_events_api import UserEventsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestUserEventsApiIntegration(IntegrationTestBase):
|
||||||
|
"""UserEventsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = UserEventsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_user_events success path"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"previous" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"auditEvents" : [ {
|
||||||
|
"accountGroupName" : "API Sandbox",
|
||||||
|
"aid" : "1234",
|
||||||
|
"date" : "2020-07-17T21:54:54Z",
|
||||||
|
"event" : "Report created.",
|
||||||
|
"ipAddress" : "99.128.0.0/11",
|
||||||
|
"uid" : "1234",
|
||||||
|
"user" : "API Sandbox User (noreply@thousandeyes.com)",
|
||||||
|
"resources" : [ {
|
||||||
|
"name" : "My New report",
|
||||||
|
"type" : "reportTitle"
|
||||||
|
}, {
|
||||||
|
"name" : "Other Report",
|
||||||
|
"type" : "testName"
|
||||||
|
} ]
|
||||||
|
}, {
|
||||||
|
"accountGroupName" : "API Sandbox",
|
||||||
|
"aid" : "1234",
|
||||||
|
"date" : "2020-07-17T22:00:54Z",
|
||||||
|
"event" : "Login failed.",
|
||||||
|
"ipAddress" : "99.128.0.0/11",
|
||||||
|
"uid" : "1234",
|
||||||
|
"user" : "API Sandbox User (noreply@thousandeyes.com)"
|
||||||
|
} ],
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_400(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 400)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_401(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_403(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_404(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_429(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_events_error_500(self) -> None:
|
||||||
|
"""Integration test for get_user_events error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
use_all_permitted_aids = False
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_events(
|
||||||
|
aid=aid,
|
||||||
|
use_all_permitted_aids=use_all_permitted_aids,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
cursor=cursor,
|
||||||
|
_headers=self.te_headers("get_user_events", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
1583
thousandeyes-sdk-administrative/test/test_users_api_integration.py
Normal file
1583
thousandeyes-sdk-administrative/test/test_users_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-agents/test/conftest.py
Normal file
7
thousandeyes-sdk-agents/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-agents/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-agents/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Agents API
|
||||||
|
|
||||||
|
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
2459
thousandeyes-sdk-agents/test/mock_manifest.py
Normal file
2459
thousandeyes-sdk-agents/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,224 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Agents API
|
||||||
|
|
||||||
|
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.agents.api.agent_proxies_api import AgentProxiesApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestAgentProxiesApiIntegration(IntegrationTestBase):
|
||||||
|
"""AgentProxiesApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = AgentProxiesApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"agentProxies" : [ {
|
||||||
|
"password" : "**********",
|
||||||
|
"isLocalConfigured" : true,
|
||||||
|
"name" : "Test Proxy - Auth Type - BASIC",
|
||||||
|
"location" : "proxy.thousandeyes.com:3128",
|
||||||
|
"lastModified" : "2022-07-17T22:00:54Z",
|
||||||
|
"authType" : "basic",
|
||||||
|
"type" : "static",
|
||||||
|
"aid" : "1234",
|
||||||
|
"bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ],
|
||||||
|
"user" : "user1",
|
||||||
|
"proxyId" : "281474976710706"
|
||||||
|
}, {
|
||||||
|
"password" : "**********",
|
||||||
|
"isLocalConfigured" : true,
|
||||||
|
"name" : "Test Proxy - Auth Type - BASIC",
|
||||||
|
"location" : "proxy.thousandeyes.com:3128",
|
||||||
|
"lastModified" : "2022-07-17T22:00:54Z",
|
||||||
|
"authType" : "basic",
|
||||||
|
"type" : "static",
|
||||||
|
"aid" : "1234",
|
||||||
|
"bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ],
|
||||||
|
"user" : "user1",
|
||||||
|
"proxyId" : "281474976710706"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_401(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_403(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_404(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_429(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_500(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_proxies_error_502(self) -> None:
|
||||||
|
"""Integration test for get_agents_proxies error path (HTTP 502)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_proxies", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,482 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Agents API
|
||||||
|
|
||||||
|
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.agents.api.cloud_and_enterprise_agent_notification_rules_api import CloudAndEnterpriseAgentNotificationRulesApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTestBase):
|
||||||
|
"""CloudAndEnterpriseAgentNotificationRulesApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = CloudAndEnterpriseAgentNotificationRulesApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule success path"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"isDefault" : false,
|
||||||
|
"expression" : "((lastContact >= 30 min))",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ruleName" : "Default Agent Offline Notification",
|
||||||
|
"ruleId" : "281474976710706",
|
||||||
|
"notifications" : {
|
||||||
|
"thirdParty" : [ {
|
||||||
|
"integrationType" : "slack",
|
||||||
|
"integrationName" : "integrationSlack1",
|
||||||
|
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||||
|
"channel" : "#slackChannel",
|
||||||
|
"integrationId" : "wb-78",
|
||||||
|
"authMethod" : "Basic",
|
||||||
|
"authUser" : "user123",
|
||||||
|
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||||
|
}, {
|
||||||
|
"integrationType" : "slack",
|
||||||
|
"integrationName" : "integrationSlack1",
|
||||||
|
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||||
|
"channel" : "#slackChannel",
|
||||||
|
"integrationId" : "wb-78",
|
||||||
|
"authMethod" : "Basic",
|
||||||
|
"authUser" : "user123",
|
||||||
|
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||||
|
} ],
|
||||||
|
"webhook" : [ {
|
||||||
|
"integrationType" : "slack",
|
||||||
|
"integrationName" : "integrationSlack1",
|
||||||
|
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||||
|
"channel" : "#slackChannel",
|
||||||
|
"integrationId" : "wb-78",
|
||||||
|
"authMethod" : "Basic",
|
||||||
|
"authUser" : "user123",
|
||||||
|
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||||
|
}, {
|
||||||
|
"integrationType" : "slack",
|
||||||
|
"integrationName" : "integrationSlack1",
|
||||||
|
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||||
|
"channel" : "#slackChannel",
|
||||||
|
"integrationId" : "wb-78",
|
||||||
|
"authMethod" : "Basic",
|
||||||
|
"authUser" : "user123",
|
||||||
|
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||||
|
} ],
|
||||||
|
"email" : {
|
||||||
|
"recipients" : [ "user1@thousandeyes.com", "user2@cisco.com" ],
|
||||||
|
"message" : "This test is failing, check as soon as possible."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notifyOnClear" : true,
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_401(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 401)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_403(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 403)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_404(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 404)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_429(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 429)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_500(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 500)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rule_error_502(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rule error path (HTTP 502)"""
|
||||||
|
notification_rule_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rule(
|
||||||
|
notification_rule_id=notification_rule_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rule", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"agentAlertRules" : [ {
|
||||||
|
"ruleId" : "281474976710706",
|
||||||
|
"ruleName" : "Default Agent Offline Notification",
|
||||||
|
"expression" : "((lastContact >= 30 min))",
|
||||||
|
"notifyOnClear" : true,
|
||||||
|
"isDefault" : false
|
||||||
|
}, {
|
||||||
|
"ruleId" : "281474976710709",
|
||||||
|
"ruleName" : "Test Rule",
|
||||||
|
"expression" : "((lastContact >= 40 min))",
|
||||||
|
"notifyOnClear" : true,
|
||||||
|
"isDefault" : true
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_401(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_403(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_404(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_429(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_500(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_notification_rules_error_502(self) -> None:
|
||||||
|
"""Integration test for get_agents_notification_rules error path (HTTP 502)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_notification_rules(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_agents_notification_rules", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,777 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Agents API
|
||||||
|
|
||||||
|
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.agents.api.enterprise_agent_cluster_api import EnterpriseAgentClusterApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase):
|
||||||
|
"""EnterpriseAgentClusterApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EnterpriseAgentClusterApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_happy_path(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "cloud",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "11",
|
||||||
|
"name" : "Label name"
|
||||||
|
}, {
|
||||||
|
"labelId" : "11",
|
||||||
|
"name" : "Label name"
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"tests" : [ {
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"enabled" : true,
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"alertsEnabled" : true,
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}, {
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"enabled" : true,
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"alertsEnabled" : true,
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
} ],
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_400(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_401(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_403(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_404(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_429(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_500(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_assign_agent_to_cluster_error_502(self) -> None:
|
||||||
|
"""Integration test for assign_agent_to_cluster error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"agents" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.assign_agent_to_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("assign_agent_to_cluster", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_happy_path(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_400(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_401(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_403(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_404(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_429(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_500(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_unassign_agent_from_cluster_error_502(self) -> None:
|
||||||
|
"""Integration test for unassign_agent_from_cluster error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"members" : [ "281474976710706" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||||
|
agent_id = '281474976710706'
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.unassign_agent_from_cluster(
|
||||||
|
agent_id=agent_id,
|
||||||
|
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("unassign_agent_from_cluster", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,304 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Agents API
|
||||||
|
|
||||||
|
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.agents.api.local_problems_api import LocalProblemsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestLocalProblemsApiIntegration(IntegrationTestBase):
|
||||||
|
"""LocalProblemsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = LocalProblemsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems success path"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"localProblems" : [ {
|
||||||
|
"duration" : 480,
|
||||||
|
"agent" : {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"countryId" : "US"
|
||||||
|
},
|
||||||
|
"endDate" : "2026-05-18T03:22:00Z",
|
||||||
|
"active" : false,
|
||||||
|
"startDate" : "2026-05-18T03:14:00Z"
|
||||||
|
}, {
|
||||||
|
"duration" : 480,
|
||||||
|
"agent" : {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"countryId" : "US"
|
||||||
|
},
|
||||||
|
"endDate" : "2026-05-18T03:22:00Z",
|
||||||
|
"active" : false,
|
||||||
|
"startDate" : "2026-05-18T03:14:00Z"
|
||||||
|
} ],
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_400(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 400)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_401(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_403(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_404(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_429(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_500(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_agents_local_problems_error_502(self) -> None:
|
||||||
|
"""Integration test for get_agents_local_problems error path (HTTP 502)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_agents_local_problems(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_agents_local_problems", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-alerts/test/conftest.py
Normal file
7
thousandeyes-sdk-alerts/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-alerts/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-alerts/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Alerts API
|
||||||
|
|
||||||
|
**Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
2247
thousandeyes-sdk-alerts/test/mock_manifest.py
Normal file
2247
thousandeyes-sdk-alerts/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
2030
thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py
Normal file
2030
thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
632
thousandeyes-sdk-alerts/test/test_alerts_api_integration.py
Normal file
632
thousandeyes-sdk-alerts/test/test_alerts_api_integration.py
Normal file
@ -0,0 +1,632 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Alerts API
|
||||||
|
|
||||||
|
**Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.alerts.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.alerts.api.alerts_api import AlertsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestAlertsApiIntegration(IntegrationTestBase):
|
||||||
|
"""AlertsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = AlertsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_alert success path"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"severity" : "major",
|
||||||
|
"alertType" : "http-server",
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"appLink" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"rule" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"alertSeverity" : "major",
|
||||||
|
"duration" : 60,
|
||||||
|
"violationCount" : 2,
|
||||||
|
"_embedded" : {
|
||||||
|
"asn" : {
|
||||||
|
"name" : "Cisco Webex LLC",
|
||||||
|
"id" : "13445",
|
||||||
|
"type" : "asn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta" : {
|
||||||
|
"version" : 1
|
||||||
|
},
|
||||||
|
"details" : [ {
|
||||||
|
"name" : "Bucharest, Romania",
|
||||||
|
"start" : {
|
||||||
|
"metrics" : "metrics"
|
||||||
|
},
|
||||||
|
"end" : {
|
||||||
|
"metrics" : "metrics"
|
||||||
|
},
|
||||||
|
"id" : "3379",
|
||||||
|
"state" : "trigger",
|
||||||
|
"type" : "cea_agent"
|
||||||
|
}, {
|
||||||
|
"name" : "Bucharest, Romania",
|
||||||
|
"start" : {
|
||||||
|
"metrics" : "metrics"
|
||||||
|
},
|
||||||
|
"end" : {
|
||||||
|
"metrics" : "metrics"
|
||||||
|
},
|
||||||
|
"id" : "3379",
|
||||||
|
"state" : "trigger",
|
||||||
|
"type" : "cea_agent"
|
||||||
|
} ],
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"suppressed" : false,
|
||||||
|
"state" : "trigger",
|
||||||
|
"alertState" : "trigger",
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_error_401(self) -> None:
|
||||||
|
"""Integration test for get_alert error path (HTTP 401)"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_error_403(self) -> None:
|
||||||
|
"""Integration test for get_alert error path (HTTP 403)"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_error_404(self) -> None:
|
||||||
|
"""Integration test for get_alert error path (HTTP 404)"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_error_429(self) -> None:
|
||||||
|
"""Integration test for get_alert error path (HTTP 429)"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alert_error_500(self) -> None:
|
||||||
|
"""Integration test for get_alert error path (HTTP 500)"""
|
||||||
|
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alert(
|
||||||
|
alert_id=alert_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_alert", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_alerts success path"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"alerts" : [ {
|
||||||
|
"severity" : "MAJOR",
|
||||||
|
"alertType" : "http-server",
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"appLink" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"rule" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"apiLinks" : [ {
|
||||||
|
"key" : ""
|
||||||
|
}, {
|
||||||
|
"key" : ""
|
||||||
|
} ],
|
||||||
|
"alertSeverity" : "major",
|
||||||
|
"dateEnd" : "2020-04-23 13:43:16",
|
||||||
|
"duration" : 60,
|
||||||
|
"violationCount" : 2,
|
||||||
|
"dateStart" : "2020-04-23 13:43:16",
|
||||||
|
"meta" : {
|
||||||
|
"version" : 1
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"suppressed" : false,
|
||||||
|
"alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "ACTIVE",
|
||||||
|
"ruleId" : 127094,
|
||||||
|
"permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12",
|
||||||
|
"alertState" : "trigger",
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"alertRuleId" : "127094"
|
||||||
|
}, {
|
||||||
|
"severity" : "MAJOR",
|
||||||
|
"alertType" : "http-server",
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"appLink" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"rule" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"apiLinks" : [ {
|
||||||
|
"key" : ""
|
||||||
|
}, {
|
||||||
|
"key" : ""
|
||||||
|
} ],
|
||||||
|
"alertSeverity" : "major",
|
||||||
|
"dateEnd" : "2020-04-23 13:43:16",
|
||||||
|
"duration" : 60,
|
||||||
|
"violationCount" : 2,
|
||||||
|
"dateStart" : "2020-04-23 13:43:16",
|
||||||
|
"meta" : {
|
||||||
|
"version" : 1
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"suppressed" : false,
|
||||||
|
"alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "ACTIVE",
|
||||||
|
"ruleId" : 127094,
|
||||||
|
"permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12",
|
||||||
|
"alertState" : "trigger",
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"alertRuleId" : "127094"
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"previous" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_error_401(self) -> None:
|
||||||
|
"""Integration test for get_alerts error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_error_403(self) -> None:
|
||||||
|
"""Integration test for get_alerts error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_error_404(self) -> None:
|
||||||
|
"""Integration test for get_alerts error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_error_429(self) -> None:
|
||||||
|
"""Integration test for get_alerts error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_alerts_error_500(self) -> None:
|
||||||
|
"""Integration test for get_alerts error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
state = thousandeyes_sdk.alerts.State()
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_alerts(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
state=state,
|
||||||
|
_headers=self.te_headers("get_alerts", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
7
thousandeyes-sdk-connectors/test/conftest.py
Normal file
7
thousandeyes-sdk-connectors/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-connectors/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-connectors/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Integrations API
|
||||||
|
|
||||||
|
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
3021
thousandeyes-sdk-connectors/test/mock_manifest.py
Normal file
3021
thousandeyes-sdk-connectors/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,210 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Integrations API
|
||||||
|
|
||||||
|
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.connectors.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestOperationConnectorsApiIntegration(IntegrationTestBase):
|
||||||
|
"""OperationConnectorsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = OperationConnectorsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors success path"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_error_400(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors error path (HTTP 400)"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_error_401(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors error path (HTTP 401)"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_error_403(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors error path (HTTP 403)"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_error_404(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors error path (HTTP 404)"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_operation_connectors_error_500(self) -> None:
|
||||||
|
"""Integration test for get_operation_connectors error path (HTTP 500)"""
|
||||||
|
type = 'webhooks'
|
||||||
|
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_operation_connectors(
|
||||||
|
type=type,
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_operation_connectors", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-credentials/test/conftest.py
Normal file
7
thousandeyes-sdk-credentials/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-credentials/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-credentials/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Credentials API
|
||||||
|
|
||||||
|
Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
604
thousandeyes-sdk-credentials/test/mock_manifest.py
Normal file
604
thousandeyes-sdk-credentials/test/mock_manifest.py
Normal file
@ -0,0 +1,604 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Credentials API
|
||||||
|
|
||||||
|
Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||||
|
|
||||||
|
OPERATION_MANIFEST = {
|
||||||
|
|
||||||
|
"create_credential": OperationExpectation(
|
||||||
|
operation_id="create_credential",
|
||||||
|
method="POST",
|
||||||
|
path="/credentials",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=201,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Example Credential",
|
||||||
|
"id" : "3247"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"name" : "Example Credential 1",
|
||||||
|
"value" : "Example Credential 1 Password"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"delete_credential": OperationExpectation(
|
||||||
|
operation_id="delete_credential",
|
||||||
|
method="DELETE",
|
||||||
|
path="/credentials/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": '3247',
|
||||||
|
},
|
||||||
|
success_status=204,
|
||||||
|
success_body=None,
|
||||||
|
success_content_type="application/json",
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_credential": OperationExpectation(
|
||||||
|
operation_id="get_credential",
|
||||||
|
method="GET",
|
||||||
|
path="/credentials/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": '3247',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Example Credential",
|
||||||
|
"id" : "3247",
|
||||||
|
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_credentials": OperationExpectation(
|
||||||
|
operation_id="get_credentials",
|
||||||
|
method="GET",
|
||||||
|
path="/credentials",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"credentials" : [ {
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Example Credential",
|
||||||
|
"id" : "3247",
|
||||||
|
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||||
|
}, {
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Example Credential",
|
||||||
|
"id" : "3247",
|
||||||
|
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"update_credential": OperationExpectation(
|
||||||
|
operation_id="update_credential",
|
||||||
|
method="PUT",
|
||||||
|
path="/credentials/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": '3247',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Example Credential",
|
||||||
|
"id" : "3247"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"name" : "Example Credential 1",
|
||||||
|
"value" : "Example Credential 1 Password"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-dashboards/test/conftest.py
Normal file
7
thousandeyes-sdk-dashboards/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-dashboards/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-dashboards/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Dashboards API
|
||||||
|
|
||||||
|
Manage ThousandEyes Dashboards.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
5061
thousandeyes-sdk-dashboards/test/mock_manifest.py
Normal file
5061
thousandeyes-sdk-dashboards/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4825
thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py
Normal file
4825
thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-emulation/test/conftest.py
Normal file
7
thousandeyes-sdk-emulation/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
37
thousandeyes-sdk-emulation/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-emulation/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Emulation API
|
||||||
|
|
||||||
|
**Note:** All Emulation APIs are not available for ThousandEyes for Government instance. The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
340
thousandeyes-sdk-emulation/test/mock_manifest.py
Normal file
340
thousandeyes-sdk-emulation/test/mock_manifest.py
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Emulation API
|
||||||
|
|
||||||
|
**Note:** All Emulation APIs are not available for ThousandEyes for Government instance. The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||||
|
|
||||||
|
OPERATION_MANIFEST = {
|
||||||
|
|
||||||
|
"create_emulated_device": OperationExpectation(
|
||||||
|
operation_id="create_emulated_device",
|
||||||
|
method="POST",
|
||||||
|
path="/emulated-devices",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=201,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_emulated_devices": OperationExpectation(
|
||||||
|
operation_id="get_emulated_devices",
|
||||||
|
method="GET",
|
||||||
|
path="/emulated-devices",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"emulatedDevices" : [ {
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
}, {
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_user_agents": OperationExpectation(
|
||||||
|
operation_id="get_user_agents",
|
||||||
|
method="GET",
|
||||||
|
path="/user-agents",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userAgents" : [ {
|
||||||
|
"os" : "Windows",
|
||||||
|
"browser" : "Firefox",
|
||||||
|
"value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36"
|
||||||
|
}, {
|
||||||
|
"os" : "Windows",
|
||||||
|
"browser" : "Firefox",
|
||||||
|
"value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,548 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Emulation API
|
||||||
|
|
||||||
|
**Note:** All Emulation APIs are not available for ThousandEyes for Government instance. The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.emulation.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.emulation.api.emulation_api import EmulationApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEmulationApiIntegration(IntegrationTestBase):
|
||||||
|
"""EmulationApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EmulationApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_error_401(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_error_403(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_error_404(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_error_429(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_emulated_device_error_500(self) -> None:
|
||||||
|
"""Integration test for create_emulated_device error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"width" : 1024,
|
||||||
|
"category" : "desktop",
|
||||||
|
"height" : 768
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
emulated_device = thousandeyes_sdk.emulation.models.EmulatedDevice.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_emulated_device(
|
||||||
|
emulated_device=emulated_device,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_emulated_device", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices success path"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"emulatedDevices" : [ {
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
}, {
|
||||||
|
"availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ],
|
||||||
|
"width" : 1024,
|
||||||
|
"name" : "iPad Pro 12.9-in",
|
||||||
|
"codeName" : "IPAD_PRO_12_9",
|
||||||
|
"id" : "11",
|
||||||
|
"category" : "desktop",
|
||||||
|
"defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0",
|
||||||
|
"height" : 768
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_error_401(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices error path (HTTP 401)"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_error_403(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices error path (HTTP 403)"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_error_404(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices error path (HTTP 404)"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_error_429(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices error path (HTTP 429)"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_emulated_devices_error_500(self) -> None:
|
||||||
|
"""Integration test for get_emulated_devices error path (HTTP 500)"""
|
||||||
|
expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_emulated_devices(
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("get_emulated_devices", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_user_agents success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userAgents" : [ {
|
||||||
|
"os" : "Windows",
|
||||||
|
"browser" : "Firefox",
|
||||||
|
"value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36"
|
||||||
|
}, {
|
||||||
|
"os" : "Windows",
|
||||||
|
"browser" : "Firefox",
|
||||||
|
"value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_error_401(self) -> None:
|
||||||
|
"""Integration test for get_user_agents error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_error_403(self) -> None:
|
||||||
|
"""Integration test for get_user_agents error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_error_404(self) -> None:
|
||||||
|
"""Integration test for get_user_agents error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_error_429(self) -> None:
|
||||||
|
"""Integration test for get_user_agents error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_user_agents_error_500(self) -> None:
|
||||||
|
"""Integration test for get_user_agents error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_user_agents(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_user_agents", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
7
thousandeyes-sdk-endpoint-agents/test/conftest.py
Normal file
7
thousandeyes-sdk-endpoint-agents/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agents API
|
||||||
|
|
||||||
|
**Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
2514
thousandeyes-sdk-endpoint-agents/test/mock_manifest.py
Normal file
2514
thousandeyes-sdk-endpoint-agents/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,365 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agents API
|
||||||
|
|
||||||
|
**Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_agents.api.endpoint_agent_log_items_api import EndpointAgentLogItemsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointAgentLogItemsApiIntegration(IntegrationTestBase):
|
||||||
|
"""EndpointAgentLogItemsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EndpointAgentLogItemsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items success path"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"logs" : [ {
|
||||||
|
"wifiLogItem" : {
|
||||||
|
"bssidFrom" : "00:11:22:33:44:54",
|
||||||
|
"bssid" : "00:11:22:33:44:55",
|
||||||
|
"failure" : {
|
||||||
|
"code" : 4,
|
||||||
|
"context" : "WPA authentication failed",
|
||||||
|
"type" : "auth"
|
||||||
|
},
|
||||||
|
"logItemType" : "wifi-connect",
|
||||||
|
"channel" : "36",
|
||||||
|
"physicalMode" : "802.11ac",
|
||||||
|
"physicalModeFrom" : "802.11n",
|
||||||
|
"ssid" : "CorpWiFi",
|
||||||
|
"channelFrom" : "11"
|
||||||
|
},
|
||||||
|
"agentLogItemType" : "wifi",
|
||||||
|
"onlineOfflineLogItem" : {
|
||||||
|
"logItemType" : "online"
|
||||||
|
},
|
||||||
|
"id" : "8d23f1b7-74ef-4e0c-925c-58601fc0662d",
|
||||||
|
"vpnLogItem" : {
|
||||||
|
"logItemType" : "vpn-connect",
|
||||||
|
"vpnServerName" : "vpn-us-west",
|
||||||
|
"vpnType" : "cisco-anyconnect",
|
||||||
|
"vpnServerAddress" : "192.0.2.10"
|
||||||
|
},
|
||||||
|
"stateChangesLogItem" : {
|
||||||
|
"logItemType" : "enabled"
|
||||||
|
},
|
||||||
|
"timestampMs" : 1709240000000
|
||||||
|
}, {
|
||||||
|
"wifiLogItem" : {
|
||||||
|
"bssidFrom" : "00:11:22:33:44:54",
|
||||||
|
"bssid" : "00:11:22:33:44:55",
|
||||||
|
"failure" : {
|
||||||
|
"code" : 4,
|
||||||
|
"context" : "WPA authentication failed",
|
||||||
|
"type" : "auth"
|
||||||
|
},
|
||||||
|
"logItemType" : "wifi-connect",
|
||||||
|
"channel" : "36",
|
||||||
|
"physicalMode" : "802.11ac",
|
||||||
|
"physicalModeFrom" : "802.11n",
|
||||||
|
"ssid" : "CorpWiFi",
|
||||||
|
"channelFrom" : "11"
|
||||||
|
},
|
||||||
|
"agentLogItemType" : "wifi",
|
||||||
|
"onlineOfflineLogItem" : {
|
||||||
|
"logItemType" : "online"
|
||||||
|
},
|
||||||
|
"id" : "8d23f1b7-74ef-4e0c-925c-58601fc0662d",
|
||||||
|
"vpnLogItem" : {
|
||||||
|
"logItemType" : "vpn-connect",
|
||||||
|
"vpnServerName" : "vpn-us-west",
|
||||||
|
"vpnType" : "cisco-anyconnect",
|
||||||
|
"vpnServerAddress" : "192.0.2.10"
|
||||||
|
},
|
||||||
|
"stateChangesLogItem" : {
|
||||||
|
"logItemType" : "enabled"
|
||||||
|
},
|
||||||
|
"timestampMs" : 1709240000000
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_400(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 400)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_401(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 401)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_403(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 403)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_429(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 429)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_500(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 500)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_agent_log_items_error_502(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_agent_log_items error path (HTTP 502)"""
|
||||||
|
agent_id = 'agent_id_example'
|
||||||
|
aid = '1234'
|
||||||
|
max = 1000
|
||||||
|
cursor = 'WyIxNzA5MjQwMDAwMDAwIl0='
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_agent_log_items(
|
||||||
|
agent_id=agent_id,
|
||||||
|
aid=aid,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
_headers=self.te_headers("get_endpoint_agent_log_items", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,300 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agents API
|
||||||
|
|
||||||
|
**Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_agents.api.endpoint_agents_transfer_api import EndpointAgentsTransferApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointAgentsTransferApiIntegration(IntegrationTestBase):
|
||||||
|
"""EndpointAgentsTransferApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EndpointAgentsTransferApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_happy_path(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"items" : [ {
|
||||||
|
"status" : 200,
|
||||||
|
"detail" : "Initiated",
|
||||||
|
"request" : {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"status" : 400,
|
||||||
|
"detail" : "Missing from-account id",
|
||||||
|
"request" : {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d5-39fc53ed1234",
|
||||||
|
"fromAid" : "xxx",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"status" : 403,
|
||||||
|
"detail" : "User does not have permission on 'to' aid",
|
||||||
|
"request" : {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d5-39fc53ed7890",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_error_400(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_error_401(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_error_403(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_error_404(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transfer_endpoint_agents_error_429(self) -> None:
|
||||||
|
"""Integration test for transfer_endpoint_agents error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"transfers" : [ {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
}, {
|
||||||
|
"agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba",
|
||||||
|
"fromAid" : "1234",
|
||||||
|
"toAid" : "12345"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.models.BulkAgentTransferRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.transfer_endpoint_agents(
|
||||||
|
aid=aid,
|
||||||
|
bulk_agent_transfer_request=bulk_agent_transfer_request,
|
||||||
|
_headers=self.te_headers("transfer_endpoint_agents", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agents API
|
||||||
|
|
||||||
|
**Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_agents.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_agents.api.endpoint_proxies_api import EndpointProxiesApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointProxiesApiIntegration(IntegrationTestBase):
|
||||||
|
"""EndpointProxiesApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EndpointProxiesApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_proxies_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_proxies success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"proxies" : [ {
|
||||||
|
"testIds" : [ "9923667", "9923667" ],
|
||||||
|
"agentIds" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
|
||||||
|
"pac" : "https://example.com/proxy.pac",
|
||||||
|
"port" : 8080,
|
||||||
|
"name" : "Local Mitmproxy",
|
||||||
|
"host" : "localhost",
|
||||||
|
"type" : "static",
|
||||||
|
"userName" : "endpoint-proxy-user",
|
||||||
|
"authType" : "none",
|
||||||
|
"bypassList" : "localhost,127.0.0.1",
|
||||||
|
"proxyId" : "101498"
|
||||||
|
}, {
|
||||||
|
"testIds" : [ "9923667", "9923667" ],
|
||||||
|
"agentIds" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
|
||||||
|
"pac" : "https://example.com/proxy.pac",
|
||||||
|
"port" : 8080,
|
||||||
|
"name" : "Local Mitmproxy",
|
||||||
|
"host" : "localhost",
|
||||||
|
"type" : "static",
|
||||||
|
"userName" : "endpoint-proxy-user",
|
||||||
|
"authType" : "none",
|
||||||
|
"bypassList" : "localhost,127.0.0.1",
|
||||||
|
"proxyId" : "101498"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_endpoint_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_proxies"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_proxies_error_401(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_proxies error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_proxies", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_proxies_error_403(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_proxies error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_proxies", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_proxies_error_429(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_proxies error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_proxies", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_proxies_error_500(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_proxies error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_proxies(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_proxies", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
7
thousandeyes-sdk-endpoint-instant-tests/test/conftest.py
Normal file
7
thousandeyes-sdk-endpoint-instant-tests/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Instant Scheduled Tests API
|
||||||
|
|
||||||
|
You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
499
thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py
Normal file
499
thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py
Normal file
@ -0,0 +1,499 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Instant Scheduled Tests API
|
||||||
|
|
||||||
|
You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||||
|
|
||||||
|
OPERATION_MANIFEST = {
|
||||||
|
|
||||||
|
"create_agent_to_server_scheduled_instant_test": OperationExpectation(
|
||||||
|
operation_id="create_agent_to_server_scheduled_instant_test",
|
||||||
|
method="POST",
|
||||||
|
path="/endpoint/tests/scheduled-tests/agent-to-server/instant",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=201,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"502": ErrorResponseExpectation(
|
||||||
|
status=502,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"create_http_server_scheduled_instant_test": OperationExpectation(
|
||||||
|
operation_id="create_http_server_scheduled_instant_test",
|
||||||
|
method="POST",
|
||||||
|
path="/endpoint/tests/scheduled-tests/http-server/instant",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=201,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"sslVersion" : "Auto",
|
||||||
|
"useNtlm" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"type" : "http-server",
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"httpVersion" : 2,
|
||||||
|
"followRedirects" : true,
|
||||||
|
"authType" : "none",
|
||||||
|
"testName" : "Test name",
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"httpTargetTime" : 100,
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"502": ErrorResponseExpectation(
|
||||||
|
status=502,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"run_endpoint_scheduled_instant_test": OperationExpectation(
|
||||||
|
operation_id="run_endpoint_scheduled_instant_test",
|
||||||
|
method="POST",
|
||||||
|
path="/endpoint/tests/scheduled-tests/{testId}/run",
|
||||||
|
path_param_examples={
|
||||||
|
"testId": '765231567',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"message" : "Successfully reran the instant scheduled test with testId=765231567"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"502": ErrorResponseExpectation(
|
||||||
|
status=502,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,369 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Instant Scheduled Tests API
|
||||||
|
|
||||||
|
You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_instant_tests.api.agent_to_server_endpoint_instant_scheduled_tests_api import AgentToServerEndpointInstantScheduledTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestAgentToServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""AgentToServerEndpointInstantScheduledTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = AgentToServerEndpointInstantScheduledTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_scheduled_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_scheduled_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"serverName" : "www.example.com",
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"testName" : "Test name"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointAgentToServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_scheduled_instant_test(
|
||||||
|
endpoint_agent_to_server_instant_test=endpoint_agent_to_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_scheduled_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,457 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Instant Scheduled Tests API
|
||||||
|
|
||||||
|
You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_instant_tests.api.http_server_endpoint_instant_scheduled_tests_api import HTTPServerEndpointInstantScheduledTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestHTTPServerEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""HTTPServerEndpointInstantScheduledTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = HTTPServerEndpointInstantScheduledTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"sslVersion" : "Auto",
|
||||||
|
"useNtlm" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"type" : "http-server",
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"httpVersion" : 2,
|
||||||
|
"followRedirects" : true,
|
||||||
|
"authType" : "none",
|
||||||
|
"testName" : "Test name",
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"httpTargetTime" : 100,
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_http_server_scheduled_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_http_server_scheduled_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"verifyCertificate" : true,
|
||||||
|
"hasPing" : true,
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
|
||||||
|
"maxMachines" : 25,
|
||||||
|
"httpTimeLimit" : 5000,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"endpointAgentLabels" : [ "567", "214" ],
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"url" : "https://example.com:443",
|
||||||
|
"agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"password" : "password",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"hasTraceroute" : true,
|
||||||
|
"targetResponseTime" : 1000,
|
||||||
|
"authType" : "none",
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name",
|
||||||
|
"username" : "username",
|
||||||
|
"sslVersionId" : "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.models.EndpointHttpServerInstantTest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_http_server_scheduled_instant_test(
|
||||||
|
endpoint_http_server_instant_test=endpoint_http_server_instant_test,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("create_http_server_scheduled_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,236 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Instant Scheduled Tests API
|
||||||
|
|
||||||
|
You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_instant_tests.api.run_endpoint_instant_scheduled_tests_api import RunEndpointInstantScheduledTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestRunEndpointInstantScheduledTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""RunEndpointInstantScheduledTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = RunEndpointInstantScheduledTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test success path"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"message" : "Successfully reran the instant scheduled test with testId=765231567"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 400)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 401)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 403)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 404)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 429)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 500)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_run_endpoint_scheduled_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for run_endpoint_scheduled_instant_test error path (HTTP 502)"""
|
||||||
|
test_id = '765231567'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.run_endpoint_scheduled_instant_test(
|
||||||
|
test_id=test_id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("run_endpoint_scheduled_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
7
thousandeyes-sdk-endpoint-labels/test/conftest.py
Normal file
7
thousandeyes-sdk-endpoint-labels/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agent Labels API
|
||||||
|
|
||||||
|
Manage labels applied to endpoint agents using this API.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
575
thousandeyes-sdk-endpoint-labels/test/mock_manifest.py
Normal file
575
thousandeyes-sdk-endpoint-labels/test/mock_manifest.py
Normal file
@ -0,0 +1,575 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Agent Labels API
|
||||||
|
|
||||||
|
Manage labels applied to endpoint agents using this API.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||||
|
|
||||||
|
OPERATION_MANIFEST = {
|
||||||
|
|
||||||
|
"create_endpoint_label": OperationExpectation(
|
||||||
|
operation_id="create_endpoint_label",
|
||||||
|
method="POST",
|
||||||
|
path="/endpoint/labels",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=201,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"delete_endpoint_label": OperationExpectation(
|
||||||
|
operation_id="delete_endpoint_label",
|
||||||
|
method="DELETE",
|
||||||
|
path="/endpoint/labels/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": 'id_example',
|
||||||
|
},
|
||||||
|
success_status=204,
|
||||||
|
success_body=None,
|
||||||
|
success_content_type="application/json",
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_endpoint_label": OperationExpectation(
|
||||||
|
operation_id="get_endpoint_label",
|
||||||
|
method="GET",
|
||||||
|
path="/endpoint/labels/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": 'id_example',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_endpoint_labels": OperationExpectation(
|
||||||
|
operation_id="get_endpoint_labels",
|
||||||
|
method="GET",
|
||||||
|
path="/endpoint/labels",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"labels" : [ {
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}, {
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"update_endpoint_label": OperationExpectation(
|
||||||
|
operation_id="update_endpoint_label",
|
||||||
|
method="PATCH",
|
||||||
|
path="/endpoint/labels/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": 'id_example',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"color" : "#ff3333",
|
||||||
|
"matchType" : "and",
|
||||||
|
"name" : "Head office meeting rooms",
|
||||||
|
"id" : "abc-123-def",
|
||||||
|
"filters" : [ {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
}, {
|
||||||
|
"mode" : "in",
|
||||||
|
"values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
|
||||||
|
"key" : "vpn-client-network"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-endpoint-test-results/test/conftest.py
Normal file
7
thousandeyes-sdk-endpoint-test-results/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Test Results API
|
||||||
|
|
||||||
|
Retrieve results for scheduled and dynamic tests on endpoint agents.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
7512
thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py
Normal file
7512
thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-endpoint-tests/test/conftest.py
Normal file
7
thousandeyes-sdk-endpoint-tests/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Tests API
|
||||||
|
|
||||||
|
Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
2809
thousandeyes-sdk-endpoint-tests/test/mock_manifest.py
Normal file
2809
thousandeyes-sdk-endpoint-tests/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,166 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Tests API
|
||||||
|
|
||||||
|
Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_tests.api.endpoint_real_user_tests_api import EndpointRealUserTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointRealUserTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""EndpointRealUserTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EndpointRealUserTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_real_user_tests_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_real_user_tests success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"realUserTests" : [ {
|
||||||
|
"includedDomains" : [ "example.com", "example.com" ],
|
||||||
|
"profileId" : "73421",
|
||||||
|
"monitoringSettings" : {
|
||||||
|
"monitoringSettingsId" : "1f5c1b5d-8a0d-4d6b-a3be-56b060f7f2c9",
|
||||||
|
"monitoringSettingsType" : "agent-tags",
|
||||||
|
"tagIds" : [ "49d9e7d2-7df5-43df-9b37-aa596b929062" ],
|
||||||
|
"labelIds" : [ "567" ]
|
||||||
|
},
|
||||||
|
"name" : "Corporate domains",
|
||||||
|
"excludedDomains" : [ "static.example.com", "static.example.com" ],
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"includedDomains" : [ "example.com", "example.com" ],
|
||||||
|
"profileId" : "73421",
|
||||||
|
"monitoringSettings" : {
|
||||||
|
"monitoringSettingsId" : "1f5c1b5d-8a0d-4d6b-a3be-56b060f7f2c9",
|
||||||
|
"monitoringSettingsType" : "agent-tags",
|
||||||
|
"tagIds" : [ "49d9e7d2-7df5-43df-9b37-aa596b929062" ],
|
||||||
|
"labelIds" : [ "567" ]
|
||||||
|
},
|
||||||
|
"name" : "Corporate domains",
|
||||||
|
"excludedDomains" : [ "static.example.com", "static.example.com" ],
|
||||||
|
"aid" : "1234"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_endpoint_real_user_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_real_user_tests"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_real_user_tests_error_401(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_real_user_tests error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_real_user_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_real_user_tests", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_real_user_tests_error_403(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_real_user_tests error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_real_user_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_real_user_tests", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_real_user_tests_error_429(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_real_user_tests error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_real_user_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_real_user_tests", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_real_user_tests_error_500(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_real_user_tests error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_real_user_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_real_user_tests", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,273 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Endpoint Tests API
|
||||||
|
|
||||||
|
Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.endpoint_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.endpoint_tests.api.endpoint_scheduled_tests_api import EndpointScheduledTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointScheduledTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""EndpointScheduledTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EndpointScheduledTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests success path"""
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"tests" : [ {
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name"
|
||||||
|
}, {
|
||||||
|
"server" : "www.example.com",
|
||||||
|
"isSavedEvent" : false,
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"isPrioritized" : false,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"tcpProbeMode" : "auto",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"protocol" : "icmp",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"ipVersion" : "V4_ONLY",
|
||||||
|
"port" : 443,
|
||||||
|
"isEnabled" : true,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"interval" : 60,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"aid" : "1234",
|
||||||
|
"agentSelectorConfig" : {
|
||||||
|
"agentSelectorType" : "all-agents",
|
||||||
|
"maxMachines" : 25
|
||||||
|
},
|
||||||
|
"hasPathTraceInSession" : true,
|
||||||
|
"testName" : "Test name"
|
||||||
|
} ],
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_error_401(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_error_403(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_error_429(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_error_500(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_endpoint_scheduled_tests_error_502(self) -> None:
|
||||||
|
"""Integration test for get_endpoint_scheduled_tests error path (HTTP 502)"""
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_endpoint_scheduled_tests(
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_endpoint_scheduled_tests", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-event-detection/test/conftest.py
Normal file
7
thousandeyes-sdk-event-detection/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Event Detection API
|
||||||
|
|
||||||
|
Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts). With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
460
thousandeyes-sdk-event-detection/test/mock_manifest.py
Normal file
460
thousandeyes-sdk-event-detection/test/mock_manifest.py
Normal file
@ -0,0 +1,460 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Event Detection API
|
||||||
|
|
||||||
|
Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts). With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
|
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||||
|
|
||||||
|
OPERATION_MANIFEST = {
|
||||||
|
|
||||||
|
"get_event": OperationExpectation(
|
||||||
|
operation_id="get_event",
|
||||||
|
method="GET",
|
||||||
|
path="/events/{id}",
|
||||||
|
path_param_examples={
|
||||||
|
"id": 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569',
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"severity" : "medium",
|
||||||
|
"summary" : "Significant number of issues detected with 66.29.146.15",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"tests" : [ {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"_links" : {
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Google test",
|
||||||
|
"testType" : "agent-to-server",
|
||||||
|
"testId" : "226770"
|
||||||
|
}, {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"_links" : {
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Google test",
|
||||||
|
"testType" : "agent-to-server",
|
||||||
|
"testId" : "226770"
|
||||||
|
} ],
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"cause" : [ "Network Loss and/or High RTT" ],
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2,
|
||||||
|
"targets" : [ {
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"ip" : "216.239.32.10",
|
||||||
|
"name" : "google.com",
|
||||||
|
"affectedTestIds" : [ "123", "1234" ],
|
||||||
|
"serverId" : "123"
|
||||||
|
}, {
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"ip" : "216.239.32.10",
|
||||||
|
"name" : "google.com",
|
||||||
|
"affectedTestIds" : [ "123", "1234" ],
|
||||||
|
"serverId" : "123"
|
||||||
|
} ]
|
||||||
|
},
|
||||||
|
"type" : "target",
|
||||||
|
"grouping" : {
|
||||||
|
"target" : "google.com"
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2,
|
||||||
|
"agents" : [ {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"agentId" : "2954",
|
||||||
|
"_links" : {
|
||||||
|
"agent" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"countryCode" : "BR",
|
||||||
|
"name" : "São Paulo, Brazil - agent",
|
||||||
|
"location" : "São Paulo, Brazil",
|
||||||
|
"affectedTestIds" : [ "2954", "2953" ],
|
||||||
|
"type" : "enterprise"
|
||||||
|
}, {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"agentId" : "2954",
|
||||||
|
"_links" : {
|
||||||
|
"agent" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"countryCode" : "BR",
|
||||||
|
"name" : "São Paulo, Brazil - agent",
|
||||||
|
"location" : "São Paulo, Brazil",
|
||||||
|
"affectedTestIds" : [ "2954", "2953" ],
|
||||||
|
"type" : "enterprise"
|
||||||
|
} ]
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"aid" : "1234",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"502": ErrorResponseExpectation(
|
||||||
|
status=502,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
"get_events": OperationExpectation(
|
||||||
|
operation_id="get_events",
|
||||||
|
method="GET",
|
||||||
|
path="/events",
|
||||||
|
path_param_examples={
|
||||||
|
},
|
||||||
|
success_status=200,
|
||||||
|
success_body=json.loads("""
|
||||||
|
|
||||||
|
{
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aid" : "1234",
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"events" : [ {
|
||||||
|
"severity" : "medium",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"title" : "Affecting destinations in google.com",
|
||||||
|
"type" : "target",
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
}, {
|
||||||
|
"severity" : "medium",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"title" : "Affecting destinations in google.com",
|
||||||
|
"type" : "target",
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""),
|
||||||
|
|
||||||
|
success_content_type="application/json",
|
||||||
|
|
||||||
|
request_body_example=None,
|
||||||
|
error_responses={
|
||||||
|
|
||||||
|
"400": ErrorResponseExpectation(
|
||||||
|
status=400,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"401": ErrorResponseExpectation(
|
||||||
|
status=401,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"403": ErrorResponseExpectation(
|
||||||
|
status=403,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"404": ErrorResponseExpectation(
|
||||||
|
status=404,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"429": ErrorResponseExpectation(
|
||||||
|
status=429,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"500": ErrorResponseExpectation(
|
||||||
|
status=500,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
"502": ErrorResponseExpectation(
|
||||||
|
status=502,
|
||||||
|
body=json.loads("""
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}"""),
|
||||||
|
content_type="application/json",
|
||||||
|
),
|
||||||
|
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,704 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Event Detection API
|
||||||
|
|
||||||
|
Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts). With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.event_detection.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.event_detection.api.events_api import EventsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestEventsApiIntegration(IntegrationTestBase):
|
||||||
|
"""EventsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = EventsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_event success path"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"severity" : "medium",
|
||||||
|
"summary" : "Significant number of issues detected with 66.29.146.15",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"tests" : [ {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"_links" : {
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Google test",
|
||||||
|
"testType" : "agent-to-server",
|
||||||
|
"testId" : "226770"
|
||||||
|
}, {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"_links" : {
|
||||||
|
"test" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name" : "Google test",
|
||||||
|
"testType" : "agent-to-server",
|
||||||
|
"testId" : "226770"
|
||||||
|
} ],
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"cause" : [ "Network Loss and/or High RTT" ],
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2,
|
||||||
|
"targets" : [ {
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"ip" : "216.239.32.10",
|
||||||
|
"name" : "google.com",
|
||||||
|
"affectedTestIds" : [ "123", "1234" ],
|
||||||
|
"serverId" : "123"
|
||||||
|
}, {
|
||||||
|
"affectedAgentIds" : [ "2954", "2953" ],
|
||||||
|
"ip" : "216.239.32.10",
|
||||||
|
"name" : "google.com",
|
||||||
|
"affectedTestIds" : [ "123", "1234" ],
|
||||||
|
"serverId" : "123"
|
||||||
|
} ]
|
||||||
|
},
|
||||||
|
"type" : "target",
|
||||||
|
"grouping" : {
|
||||||
|
"target" : "google.com"
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2,
|
||||||
|
"agents" : [ {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"agentId" : "2954",
|
||||||
|
"_links" : {
|
||||||
|
"agent" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"countryCode" : "BR",
|
||||||
|
"name" : "São Paulo, Brazil - agent",
|
||||||
|
"location" : "São Paulo, Brazil",
|
||||||
|
"affectedTestIds" : [ "2954", "2953" ],
|
||||||
|
"type" : "enterprise"
|
||||||
|
}, {
|
||||||
|
"affectedTargetIds" : [ "123", "1234" ],
|
||||||
|
"agentId" : "2954",
|
||||||
|
"_links" : {
|
||||||
|
"agent" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"countryCode" : "BR",
|
||||||
|
"name" : "São Paulo, Brazil - agent",
|
||||||
|
"location" : "São Paulo, Brazil",
|
||||||
|
"affectedTestIds" : [ "2954", "2953" ],
|
||||||
|
"type" : "enterprise"
|
||||||
|
} ]
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"aid" : "1234",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_401(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 401)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_403(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 403)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_404(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 404)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_429(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 429)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_500(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 500)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_event_error_502(self) -> None:
|
||||||
|
"""Integration test for get_event error path (HTTP 502)"""
|
||||||
|
id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||||
|
aid = '1234'
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_event(
|
||||||
|
id=id,
|
||||||
|
aid=aid,
|
||||||
|
_headers=self.te_headers("get_event", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_happy_path(self) -> None:
|
||||||
|
"""Integration test for get_events success path"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"endDate" : "2022-07-18T22:00:54Z",
|
||||||
|
"_links" : {
|
||||||
|
"next" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
},
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aid" : "1234",
|
||||||
|
"startDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"events" : [ {
|
||||||
|
"severity" : "medium",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"title" : "Affecting destinations in google.com",
|
||||||
|
"type" : "target",
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
}, {
|
||||||
|
"severity" : "medium",
|
||||||
|
"agentType" : "cloud-enterprise-agent",
|
||||||
|
"affectedTests" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"endDate" : "2020-04-23T13:43:16Z",
|
||||||
|
"_links" : {
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typeName" : "Network Issue",
|
||||||
|
"title" : "Affecting destinations in google.com",
|
||||||
|
"type" : "target",
|
||||||
|
"affectedTargets" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"affectedAgents" : {
|
||||||
|
"total" : 5,
|
||||||
|
"inAccountGroup" : 2
|
||||||
|
},
|
||||||
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||||
|
"state" : "resolved",
|
||||||
|
"startDate" : "2020-04-23T13:43:16Z"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_400(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 400)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_401(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 401)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_403(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 403)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_404(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 404)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_429(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 429)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_500(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 500)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_events_error_502(self) -> None:
|
||||||
|
"""Integration test for get_events error path (HTTP 502)"""
|
||||||
|
aid = '1234'
|
||||||
|
window = '12h'
|
||||||
|
start_date = '2022-07-17T22:00:54Z'
|
||||||
|
end_date = '2022-07-18T22:00:54Z'
|
||||||
|
max = 5
|
||||||
|
cursor = 'cursor_example'
|
||||||
|
ongoing = true
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 6
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.get_events(
|
||||||
|
aid=aid,
|
||||||
|
window=window,
|
||||||
|
start_date=start_date,
|
||||||
|
end_date=end_date,
|
||||||
|
max=max,
|
||||||
|
cursor=cursor,
|
||||||
|
ongoing=ongoing,
|
||||||
|
_headers=self.te_headers("get_events", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
7
thousandeyes-sdk-instant-tests/test/conftest.py
Normal file
7
thousandeyes-sdk-instant-tests/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
3980
thousandeyes-sdk-instant-tests/test/mock_manifest.py
Normal file
3980
thousandeyes-sdk-instant-tests/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,816 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.agent_to_agent_instant_tests_api import AgentToAgentInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestAgentToAgentInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""AgentToAgentInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = AgentToAgentInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_agent_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_agent_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "agent-to-agent",
|
||||||
|
"mss" : 100,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"throughputRate" : 10,
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"direction" : "to-target",
|
||||||
|
"throughputMeasurements" : false,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"throughputDuration" : 10000,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 49153,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "2954",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToAgentInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_agent_instant_test(
|
||||||
|
agent_to_agent_instant_test_request=agent_to_agent_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_agent_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,825 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.agent_to_server_instant_tests_api import AgentToServerInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestAgentToServerInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""AgentToServerInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = AgentToServerInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ],
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_agent_to_server_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_agent_to_server_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"server" : "www.thousandeyes.com:80",
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "agent-to-server",
|
||||||
|
"dscpId" : "0",
|
||||||
|
"fixedPacketRate" : 25,
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : false,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"pingPayloadSize" : 112,
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"continuousMode" : false
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.models.AgentToServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_agent_to_server_instant_test(
|
||||||
|
agent_to_server_instant_test_request=agent_to_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_agent_to_server_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,831 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.dns_server_instant_tests_api import DNSServerInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestDNSServerInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""DNSServerInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = DNSServerInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ {
|
||||||
|
"serverName" : "dns-example.net",
|
||||||
|
"serverId" : "1447"
|
||||||
|
}, {
|
||||||
|
"serverName" : "dns-example.net",
|
||||||
|
"serverId" : "1447"
|
||||||
|
} ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_server_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_dns_server_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "dns-server",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"dnsServers" : [ "dns-example.net", "8.8.8.8" ],
|
||||||
|
"recursiveQueries" : true,
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_server_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_server_instant_test(
|
||||||
|
dns_server_instant_test_request=dns_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_server_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,726 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.dns_trace_instant_tests_api import DNSTraceInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestDNSTraceInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""DNSTraceInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = DNSTraceInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_trace_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_dns_trace_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"dnsTransportProtocol" : "udp",
|
||||||
|
"type" : "dns-trace",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsTraceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_trace_instant_test(
|
||||||
|
dns_trace_instant_test_request=dns_trace_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_trace_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,717 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.dnssec_instant_tests_api import DNSSECInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestDNSSECInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""DNSSECInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = DNSSECInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_dns_sec_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_dns_sec_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"dnsQueryClass" : "in",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "dnssec",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"domain" : "www.thousandeyes.com",
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"testName" : "ThousandEyes Test"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.models.DnsSecInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_dns_sec_instant_test(
|
||||||
|
dns_sec_instant_test_request=dns_sec_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_dns_sec_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,861 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.ftp_server_instant_tests_api import FTPServerInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestFTPServerInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""FTPServerInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = FTPServerInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_ftp_server_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_ftp_server_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"downloadLimit" : 1048576,
|
||||||
|
"bandwidthMeasurements" : true,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"useExplicitFtps" : false,
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "ftp-server",
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"ftpTargetTime" : 1400,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"requestType" : "download",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"url" : "www.thousandeyes.com",
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"ftpTimeLimit" : 10,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ],
|
||||||
|
"useActiveFtp" : false,
|
||||||
|
"username" : "username"
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.models.FtpServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_ftp_server_instant_test(
|
||||||
|
ftp_server_instant_test_request=ftp_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_ftp_server_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.instant_tests_api import InstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""InstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = InstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,868 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.sip_server_instant_tests_api import SIPServerInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestSIPServerInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""SIPServerInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = SIPServerInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"authUser" : "username",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\"a-z\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"port" : 49153,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ],
|
||||||
|
"user" : "username"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_sip_server_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_sip_server_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"mtuMeasurements" : false,
|
||||||
|
"ipv6Policy" : "use-agent-policy",
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"registerEnabled" : false,
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"probeMode" : "auto",
|
||||||
|
"type" : "sip-server",
|
||||||
|
"fixedPacketRate" : 50,
|
||||||
|
"pathTraceMode" : "classic",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"targetSipCredentials" : {
|
||||||
|
"password" : "password",
|
||||||
|
"protocol" : "tcp",
|
||||||
|
"port" : 49153,
|
||||||
|
"sipRegistrar" : "voice.thousandeyes.com",
|
||||||
|
"authUser" : "username",
|
||||||
|
"user" : "username"
|
||||||
|
},
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"sipTargetTime" : 1000,
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"optionsRegex" : "[\\"a-z\\"]",
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"networkMeasurements" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"sipTimeLimit" : 5,
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
sip_server_instant_test_request = thousandeyes_sdk.instant_tests.models.SipServerInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_sip_server_instant_test(
|
||||||
|
sip_server_instant_test_request=sip_server_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_sip_server_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@ -0,0 +1,780 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Instant Tests API
|
||||||
|
|
||||||
|
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
import unittest
|
||||||
|
import thousandeyes_sdk.instant_tests.models
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.exceptions import ApiException
|
||||||
|
from thousandeyes_sdk.instant_tests.api.voice_instant_tests_api import VoiceInstantTestsApi
|
||||||
|
from .integration_test_utils import IntegrationTestBase
|
||||||
|
from .test_utils import assert_constructed_model_matches_example_json
|
||||||
|
|
||||||
|
|
||||||
|
class TestVoiceInstantTestsApiIntegration(IntegrationTestBase):
|
||||||
|
"""VoiceInstantTestsApi integration test stubs"""
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
super().setUp()
|
||||||
|
self.api = VoiceInstantTestsApi(self.api_client)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_happy_path(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test success path"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
response_body_json = """
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
}, {
|
||||||
|
"labelId" : "961",
|
||||||
|
"name" : "Artem label",
|
||||||
|
"isBuiltin" : false
|
||||||
|
} ],
|
||||||
|
"tags" : [ {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
}, {
|
||||||
|
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||||
|
"value" : "San Francisco",
|
||||||
|
"key" : "Location"
|
||||||
|
} ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
}, {
|
||||||
|
"agentId" : "281474976710706",
|
||||||
|
"agentType" : "enterprise-cluster",
|
||||||
|
"prefix" : "99.128.0.0/11",
|
||||||
|
"coordinates" : {
|
||||||
|
"latitude" : 37.77493,
|
||||||
|
"longitude" : -122.41942
|
||||||
|
},
|
||||||
|
"agentName" : "thousandeyes-stg-va-254",
|
||||||
|
"networkProviderInfo" : {
|
||||||
|
"asn" : 7018,
|
||||||
|
"name" : "AT&T Services, Inc.",
|
||||||
|
"type" : "isp"
|
||||||
|
},
|
||||||
|
"countryId" : "US",
|
||||||
|
"enabled" : true,
|
||||||
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||||
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||||
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||||
|
"location" : "San Francisco Bay Area",
|
||||||
|
"verifySslCertificates" : true
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
}, {
|
||||||
|
"name" : "Account name",
|
||||||
|
"aid" : "1234"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_response = json.loads(response_body_json)
|
||||||
|
response = self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(response, expected_response)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_400(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 400)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"errors" : [ {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
}, {
|
||||||
|
"code" : "code",
|
||||||
|
"field" : "field",
|
||||||
|
"message" : "message"
|
||||||
|
} ],
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(400)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="400"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_401(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 401)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"error_description" : "Invalid access token",
|
||||||
|
"error" : "invalid_token"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(401)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="401"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_403(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 403)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(403)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="403"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_404(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 404)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(404)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="404"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_429(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 429)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(429)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="429"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_500(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 500)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(500)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="500"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_voice_instant_test_error_502(self) -> None:
|
||||||
|
"""Integration test for create_voice_instant_test error path (HTTP 502)"""
|
||||||
|
request_body_json = """
|
||||||
|
|
||||||
|
{
|
||||||
|
"_links" : {
|
||||||
|
"testResults" : [ {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||||
|
}, {
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||||
|
} ],
|
||||||
|
"self" : {
|
||||||
|
"hreflang" : "hreflang",
|
||||||
|
"templated" : true,
|
||||||
|
"profile" : "profile",
|
||||||
|
"name" : "name",
|
||||||
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||||
|
"type" : "type",
|
||||||
|
"deprecation" : "deprecation",
|
||||||
|
"title" : "title"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description" : "ThousandEyes Test",
|
||||||
|
"type" : "voice",
|
||||||
|
"jitterBuffer" : 40,
|
||||||
|
"dscpId" : "0",
|
||||||
|
"duration" : 5,
|
||||||
|
"dscp" : "Best Effort (DSCP 0)",
|
||||||
|
"modifiedBy" : "user@user.com",
|
||||||
|
"testName" : "ThousandEyes Test",
|
||||||
|
"numPathTraces" : 3,
|
||||||
|
"liveShare" : false,
|
||||||
|
"savedEvent" : true,
|
||||||
|
"labels" : [ "9842", "1283" ],
|
||||||
|
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
|
||||||
|
"agents" : [ {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
}, {
|
||||||
|
"agentId" : "125",
|
||||||
|
"sourceIpAddress" : "1.1.1.1"
|
||||||
|
} ],
|
||||||
|
"codec" : "G.711 @ 64 Kbps",
|
||||||
|
"codecId" : "0",
|
||||||
|
"createdDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"createdBy" : "user@user.com",
|
||||||
|
"port" : 1024,
|
||||||
|
"randomizedStartTime" : false,
|
||||||
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||||
|
"targetAgentId" : "281474976710706",
|
||||||
|
"testId" : "281474976710706",
|
||||||
|
"sharedWithAccounts" : [ "1234", "12345" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
voice_instant_test_request = thousandeyes_sdk.instant_tests.models.VoiceInstantTestRequest.from_json(request_body_json)
|
||||||
|
aid = '1234'
|
||||||
|
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
|
||||||
|
error_body_json = """
|
||||||
|
{
|
||||||
|
"instance" : "instance",
|
||||||
|
"detail" : "detail",
|
||||||
|
"type" : "type",
|
||||||
|
"title" : "title",
|
||||||
|
"status" : 0
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
expected_error = json.loads(error_body_json)
|
||||||
|
with self.assertRaises(
|
||||||
|
ApiException.exception_class_for_http_status(502)
|
||||||
|
) as context:
|
||||||
|
self.api.create_voice_instant_test(
|
||||||
|
voice_instant_test_request=voice_instant_test_request,
|
||||||
|
aid=aid,
|
||||||
|
expand=expand,
|
||||||
|
_headers=self.te_headers("create_voice_instant_test", error_status="502"),
|
||||||
|
)
|
||||||
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
File diff suppressed because it is too large
Load Diff
7
thousandeyes-sdk-internet-insights/test/conftest.py
Normal file
7
thousandeyes-sdk-internet-insights/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
_repo_root = Path(__file__).resolve().parents[2]
|
||||||
|
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||||
|
if str(_core_test_support) not in sys.path:
|
||||||
|
sys.path.insert(0, str(_core_test_support))
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Internet Insights API
|
||||||
|
|
||||||
|
**Note:** All Internet Insights APIs are not available for ThousandEyes for Government instance. We are happy to announce the release of the Internet Insights API set. This limited release includes endpoints that: * Make our catalog provider and Internet outage data accessible to API users. * Provide access to advanced filtering, which is part of our next-generation API efforts to allow API users to fine-tune queries across all of our APIs in a consistent manner. Internet Insights provide visibility into core Internet infrastructure, including ISPs, DNS providers, IaaS, CDNs , and SaaS providers. It tracks the macro-level impact of Internet events on individual users and enterprise networks connecting at the edge of the Internet. These events include Outages, Routing hijacks and leaks, DDoS attacks, And political interference, among others. Future releases of the Internet Insights API set will further unlock access to core Internet Insights functionality, unlocking potential integrations to enrich customer process flows. For more information about Internet Insights, see the [Internet Insights](https://docs.thousandeyes.com/product-documentation/internet-insights).
|
||||||
|
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from thousandeyes_sdk.core.api_client import ApiClient
|
||||||
|
from thousandeyes_sdk.core.configuration import Configuration
|
||||||
|
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||||
|
|
||||||
|
from .mock_manifest import OPERATION_MANIFEST
|
||||||
|
|
||||||
|
|
||||||
|
class IntegrationTestBase(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||||
|
self.server.start()
|
||||||
|
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||||
|
self.api_client = ApiClient(configuration=configuration)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.server.stop()
|
||||||
|
|
||||||
|
def te_headers(self, operation_id: str, error_status=None):
|
||||||
|
headers = {OPERATION_ID_HEADER: operation_id}
|
||||||
|
if error_status is not None:
|
||||||
|
headers[ERROR_STATUS_HEADER] = error_status
|
||||||
|
return headers
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user